baza.rb 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/typos.yml +1 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +12 -6
- data/lib/baza-rb/version.rb +1 -1
- data/lib/baza-rb.rb +1 -1
- data/test/test_baza-rb.rb +15 -26
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a06284ab2458dd981b2fe05c7334f332c2ab698a1f928af4be587c2efd5fa932
|
4
|
+
data.tar.gz: 8a646fe6ee1389319e10e1c12060d30dc0cea229bd25d95e82a025495b017608
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16a032097d4a21913b2ac9c24cd2248ef7171e5fc3a4caf02a71c1e403c38206721cc067aec2518fdce494b0ffb56dfd03808f36fc82355d4ac91f18b025ea9c
|
7
|
+
data.tar.gz: 20578325b7d02729ab8b0c65fd0f4aa723de2c74a9ae8f324cc3508d2fea359483ef97c995a65a74369a7657ae8051e9c99cfa13aac87474206392b2d22a6cd9
|
data/.github/workflows/typos.yml
CHANGED
data/Gemfile
CHANGED
@@ -10,6 +10,7 @@ gem 'base64', '~>0.3', require: false
|
|
10
10
|
gem 'factbase', '~>0.11', require: false
|
11
11
|
gem 'minitest', '~>5.25', require: false
|
12
12
|
gem 'minitest-reporters', '~>1.7', require: false
|
13
|
+
gem 'online', '~>0.0', require: false
|
13
14
|
gem 'os', '~>1.1', require: false
|
14
15
|
gem 'puma', '~>6.6', require: false
|
15
16
|
gem 'qbash', '~>0.4', require: false
|
data/Gemfile.lock
CHANGED
@@ -28,16 +28,18 @@ GEM
|
|
28
28
|
crack (1.0.0)
|
29
29
|
bigdecimal
|
30
30
|
rexml
|
31
|
-
decoor (0.0
|
31
|
+
decoor (0.1.0)
|
32
32
|
docile (1.4.1)
|
33
|
-
elapsed (0.0
|
33
|
+
elapsed (0.1.0)
|
34
34
|
loog (> 0)
|
35
35
|
tago (> 0)
|
36
|
+
ellipsized (0.3.0)
|
36
37
|
ethon (0.16.0)
|
37
38
|
ffi (>= 1.15.0)
|
38
|
-
factbase (0.
|
39
|
+
factbase (0.12.1)
|
39
40
|
backtrace (~> 0.4)
|
40
41
|
decoor (~> 0.0)
|
42
|
+
ellipsized (~> 0.3)
|
41
43
|
json (~> 2.7)
|
42
44
|
logger (~> 1.0)
|
43
45
|
loog (~> 0.6)
|
@@ -55,7 +57,7 @@ GEM
|
|
55
57
|
multipart-post (~> 2.0)
|
56
58
|
faraday-net_http (3.4.1)
|
57
59
|
net-http (>= 0.5.0)
|
58
|
-
faraday-retry (2.3.
|
60
|
+
faraday-retry (2.3.2)
|
59
61
|
faraday (~> 2.0)
|
60
62
|
ffi (1.17.2-arm64-darwin)
|
61
63
|
ffi (1.17.2-x64-mingw-ucrt)
|
@@ -89,8 +91,10 @@ GEM
|
|
89
91
|
racc (~> 1.4)
|
90
92
|
nokogiri (1.18.8-x86_64-linux-gnu)
|
91
93
|
racc (~> 1.4)
|
94
|
+
online (0.0.1)
|
95
|
+
timeout (~> 0.4)
|
92
96
|
os (1.1.4)
|
93
|
-
others (0.
|
97
|
+
others (0.1.1)
|
94
98
|
parallel (1.27.0)
|
95
99
|
parser (3.3.8.0)
|
96
100
|
ast (~> 2.4.1)
|
@@ -122,7 +126,7 @@ GEM
|
|
122
126
|
regexp_parser (2.10.0)
|
123
127
|
retries (0.0.5)
|
124
128
|
rexml (3.4.1)
|
125
|
-
rubocop (1.
|
129
|
+
rubocop (1.77.0)
|
126
130
|
json (~> 2.3)
|
127
131
|
language_server-protocol (~> 3.17.0.2)
|
128
132
|
lint_roller (~> 1.1.0)
|
@@ -167,6 +171,7 @@ GEM
|
|
167
171
|
tilt (~> 2.0)
|
168
172
|
tago (0.1.0)
|
169
173
|
tilt (2.6.0)
|
174
|
+
timeout (0.4.3)
|
170
175
|
typhoeus (1.4.1)
|
171
176
|
ethon (>= 0.9.0)
|
172
177
|
unicode-display_width (3.1.4)
|
@@ -197,6 +202,7 @@ DEPENDENCIES
|
|
197
202
|
factbase (~> 0.11)
|
198
203
|
minitest (~> 5.25)
|
199
204
|
minitest-reporters (~> 1.7)
|
205
|
+
online (~> 0.0)
|
200
206
|
os (~> 1.1)
|
201
207
|
puma (~> 6.6)
|
202
208
|
qbash (~> 0.4)
|
data/lib/baza-rb/version.rb
CHANGED
data/lib/baza-rb.rb
CHANGED
@@ -529,7 +529,7 @@ class BazaRb
|
|
529
529
|
# @return [String] The cached result or newly computed result from the block
|
530
530
|
# @raise [ServerFailure] If the valve operation fails
|
531
531
|
def enter(name, badge, why, job)
|
532
|
-
elapsed(@loog,
|
532
|
+
elapsed(@loog, good: "Entered valve #{badge} to #{name}") do
|
533
533
|
retry_it do
|
534
534
|
ret = get(home.append('valves').append('result').add(badge:), [200, 204])
|
535
535
|
return ret.body if ret.code == 200
|
data/test/test_baza-rb.rb
CHANGED
@@ -7,6 +7,7 @@ require 'factbase'
|
|
7
7
|
require 'loog'
|
8
8
|
require 'net/http'
|
9
9
|
require 'qbash'
|
10
|
+
require 'online'
|
10
11
|
require 'random-port'
|
11
12
|
require 'securerandom'
|
12
13
|
require 'socket'
|
@@ -36,7 +37,7 @@ class TestBazaRb < Minitest::Test
|
|
36
37
|
|
37
38
|
def test_live_full_cycle
|
38
39
|
WebMock.enable_net_connect!
|
39
|
-
skip('We are offline') unless we_are_online
|
40
|
+
skip('We are offline') unless we_are_online?
|
40
41
|
fb = Factbase.new
|
41
42
|
fb.insert.foo = 'test-' * 10_000
|
42
43
|
fb.insert
|
@@ -62,13 +63,13 @@ class TestBazaRb < Minitest::Test
|
|
62
63
|
|
63
64
|
def test_live_whoami
|
64
65
|
WebMock.enable_net_connect!
|
65
|
-
skip('We are offline') unless we_are_online
|
66
|
+
skip('We are offline') unless we_are_online?
|
66
67
|
refute_nil(LIVE.whoami)
|
67
68
|
end
|
68
69
|
|
69
70
|
def test_live_balance
|
70
71
|
WebMock.enable_net_connect!
|
71
|
-
skip('We are offline') unless we_are_online
|
72
|
+
skip('We are offline') unless we_are_online?
|
72
73
|
z = LIVE.balance
|
73
74
|
refute_nil(z)
|
74
75
|
assert(z.to_f)
|
@@ -76,13 +77,13 @@ class TestBazaRb < Minitest::Test
|
|
76
77
|
|
77
78
|
def test_live_fee_payment
|
78
79
|
WebMock.enable_net_connect!
|
79
|
-
skip('We are offline') unless we_are_online
|
80
|
+
skip('We are offline') unless we_are_online?
|
80
81
|
refute_nil(LIVE.fee('unknown', 0.007, 'just for fun', 777))
|
81
82
|
end
|
82
83
|
|
83
84
|
def test_live_push_no_compression
|
84
85
|
WebMock.enable_net_connect!
|
85
|
-
skip('We are offline') unless we_are_online
|
86
|
+
skip('We are offline') unless we_are_online?
|
86
87
|
fb = Factbase.new
|
87
88
|
fb.insert.foo = 'test-' * 10_000
|
88
89
|
fb.insert
|
@@ -92,7 +93,7 @@ class TestBazaRb < Minitest::Test
|
|
92
93
|
|
93
94
|
def test_live_durable_lock_unlock
|
94
95
|
WebMock.enable_net_connect!
|
95
|
-
skip('We are offline') unless we_are_online
|
96
|
+
skip('We are offline') unless we_are_online?
|
96
97
|
Dir.mktmpdir do |dir|
|
97
98
|
file = File.join(dir, 'before.bin')
|
98
99
|
before = 'hello, Джеф!' * 10
|
@@ -116,7 +117,7 @@ class TestBazaRb < Minitest::Test
|
|
116
117
|
|
117
118
|
def test_live_enter_valve
|
118
119
|
WebMock.enable_net_connect!
|
119
|
-
skip('We are offline') unless we_are_online
|
120
|
+
skip('We are offline') unless we_are_online?
|
120
121
|
r = 'something'
|
121
122
|
n = fake_name
|
122
123
|
badge = fake_name
|
@@ -126,7 +127,7 @@ class TestBazaRb < Minitest::Test
|
|
126
127
|
|
127
128
|
def test_get_csrf_token
|
128
129
|
WebMock.enable_net_connect!
|
129
|
-
skip('We are offline') unless we_are_online
|
130
|
+
skip('We are offline') unless we_are_online?
|
130
131
|
assert_operator(LIVE.csrf.length, :>, 10)
|
131
132
|
end
|
132
133
|
|
@@ -367,7 +368,7 @@ class TestBazaRb < Minitest::Test
|
|
367
368
|
|
368
369
|
def test_real_http
|
369
370
|
WebMock.enable_net_connect!
|
370
|
-
skip('We are offline') unless we_are_online
|
371
|
+
skip('We are offline') unless we_are_online?
|
371
372
|
req =
|
372
373
|
with_http_server(200, 'yes') do |baza|
|
373
374
|
baza.name_exists?('simple')
|
@@ -377,7 +378,7 @@ class TestBazaRb < Minitest::Test
|
|
377
378
|
|
378
379
|
def test_push_with_meta
|
379
380
|
WebMock.enable_net_connect!
|
380
|
-
skip('We are offline') unless we_are_online
|
381
|
+
skip('We are offline') unless we_are_online?
|
381
382
|
req =
|
382
383
|
with_http_server(200, 'yes') do |baza|
|
383
384
|
baza.push('simple', 'hello, world!', ['boom!', 'хей!'])
|
@@ -387,7 +388,7 @@ class TestBazaRb < Minitest::Test
|
|
387
388
|
|
388
389
|
def test_push_with_big_meta
|
389
390
|
WebMock.enable_net_connect!
|
390
|
-
skip('We are offline') unless we_are_online
|
391
|
+
skip('We are offline') unless we_are_online?
|
391
392
|
req =
|
392
393
|
with_http_server(200, 'yes') do |baza|
|
393
394
|
baza.push(
|
@@ -405,7 +406,7 @@ class TestBazaRb < Minitest::Test
|
|
405
406
|
|
406
407
|
def test_push_compressed_content
|
407
408
|
WebMock.enable_net_connect!
|
408
|
-
skip('We are offline') unless we_are_online
|
409
|
+
skip('We are offline') unless we_are_online?
|
409
410
|
fb = Factbase.new
|
410
411
|
fb.insert.foo = 'test-' * 10_000
|
411
412
|
req =
|
@@ -770,20 +771,8 @@ class TestBazaRb < Minitest::Test
|
|
770
771
|
"fake#{SecureRandom.hex(8)}"
|
771
772
|
end
|
772
773
|
|
773
|
-
def we_are_online
|
774
|
-
$we_are_online ||= !ARGV.include?('--offline') &&
|
774
|
+
def we_are_online?
|
775
|
+
$we_are_online ||= !ARGV.include?('--offline') && online?
|
775
776
|
end
|
776
777
|
# rubocop:enable Style/GlobalVars
|
777
|
-
|
778
|
-
# Checks whether this URI is alive (HTTP status is 200).
|
779
|
-
def uri_is_alive(uri)
|
780
|
-
Timeout.timeout(4) do
|
781
|
-
require 'net/http'
|
782
|
-
WebMock.enable_net_connect!
|
783
|
-
Net::HTTP.get_response(URI(uri)).is_a?(Net::HTTPSuccess)
|
784
|
-
rescue Timeout::Error, Timeout::ExitException, Socket::ResolutionError, Errno::EHOSTUNREACH, Errno::EINVAL
|
785
|
-
puts "Ping failed to #{uri}"
|
786
|
-
false
|
787
|
-
end
|
788
|
-
end
|
789
778
|
end
|