zold 0.31.8 → 0.31.9

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.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/.0pdd.yml +20 -0
  3. data/.github/workflows/actionlint.yml +41 -0
  4. data/.github/workflows/codecov.yml +23 -4
  5. data/.github/workflows/copyrights.yml +30 -0
  6. data/.github/workflows/pdd.yml +26 -3
  7. data/.github/workflows/rake.yml +24 -2
  8. data/.github/workflows/xcop.yml +21 -2
  9. data/.github/workflows/yamllint.yml +34 -0
  10. data/.gitignore +2 -1
  11. data/.rubocop.yml +21 -0
  12. data/.ruby-version +1 -1
  13. data/.rultor.yml +35 -5
  14. data/.simplecov +1 -1
  15. data/Dockerfile +29 -3
  16. data/Gemfile +10 -10
  17. data/Gemfile.lock +340 -0
  18. data/LICENSE.txt +1 -1
  19. data/Rakefile +9 -12
  20. data/bin/zold +1 -1
  21. data/cucumber.yml +20 -0
  22. data/deploy.sh +20 -0
  23. data/features/step_definitions/steps.rb +1 -1
  24. data/features/support/env.rb +1 -1
  25. data/fixtures/merge/asserts.rb +1 -1
  26. data/fixtures/merge/into_no_wallet/assert.rb +1 -1
  27. data/fixtures/merge/legacy_negatives_stay/assert.rb +1 -1
  28. data/fixtures/merge/missed_wallets/assert.rb +1 -1
  29. data/fixtures/merge/negative_overwriting/assert.rb +1 -1
  30. data/fixtures/merge/negatives_in_between/assert.rb +1 -1
  31. data/fixtures/merge/random_expenses/assert.rb +1 -1
  32. data/fixtures/merge/simple_case/assert.rb +1 -1
  33. data/fixtures/merge/unconfirmed_income/assert.rb +1 -1
  34. data/fixtures/scripts/_head.sh +21 -1
  35. data/fixtures/scripts/calculate-scores.sh +19 -0
  36. data/fixtures/scripts/distribute-wallet.sh +19 -0
  37. data/fixtures/scripts/print-helps.sh +19 -0
  38. data/fixtures/scripts/pull-on-start.sh +19 -0
  39. data/fixtures/scripts/push-and-pull.sh +19 -0
  40. data/fixtures/scripts/redeploy-on-upgrade.sh +19 -0
  41. data/fixtures/scripts/spread-wallets.sh +19 -0
  42. data/lib/zold/age.rb +2 -2
  43. data/lib/zold/amount.rb +2 -2
  44. data/lib/zold/cached_wallets.rb +3 -3
  45. data/lib/zold/commands/alias.rb +20 -0
  46. data/lib/zold/commands/args.rb +2 -2
  47. data/lib/zold/commands/calculate.rb +2 -2
  48. data/lib/zold/commands/clean.rb +2 -2
  49. data/lib/zold/commands/create.rb +2 -2
  50. data/lib/zold/commands/diff.rb +2 -2
  51. data/lib/zold/commands/fetch.rb +2 -2
  52. data/lib/zold/commands/invoice.rb +2 -2
  53. data/lib/zold/commands/list.rb +2 -2
  54. data/lib/zold/commands/merge.rb +2 -2
  55. data/lib/zold/commands/next.rb +2 -2
  56. data/lib/zold/commands/node.rb +2 -2
  57. data/lib/zold/commands/pay.rb +2 -2
  58. data/lib/zold/commands/propagate.rb +2 -2
  59. data/lib/zold/commands/pull.rb +2 -2
  60. data/lib/zold/commands/push.rb +2 -2
  61. data/lib/zold/commands/remote.rb +2 -2
  62. data/lib/zold/commands/remove.rb +2 -2
  63. data/lib/zold/commands/routines/audit.rb +2 -2
  64. data/lib/zold/commands/routines/gc.rb +2 -2
  65. data/lib/zold/commands/routines/reconcile.rb +2 -2
  66. data/lib/zold/commands/routines/reconnect.rb +2 -2
  67. data/lib/zold/commands/routines/retire.rb +2 -2
  68. data/lib/zold/commands/routines/spread.rb +2 -2
  69. data/lib/zold/commands/routines.rb +2 -2
  70. data/lib/zold/commands/show.rb +2 -2
  71. data/lib/zold/commands/taxes.rb +2 -2
  72. data/lib/zold/commands/thread_badge.rb +3 -3
  73. data/lib/zold/copies.rb +2 -2
  74. data/lib/zold/dir_items.rb +2 -2
  75. data/lib/zold/endless.rb +2 -2
  76. data/lib/zold/gem.rb +2 -2
  77. data/lib/zold/hands.rb +2 -2
  78. data/lib/zold/head.rb +3 -3
  79. data/lib/zold/hexnum.rb +2 -2
  80. data/lib/zold/http.rb +3 -3
  81. data/lib/zold/hungry_wallets.rb +2 -2
  82. data/lib/zold/id.rb +2 -2
  83. data/lib/zold/json_page.rb +2 -2
  84. data/lib/zold/key.rb +2 -2
  85. data/lib/zold/log.rb +2 -2
  86. data/lib/zold/metronome.rb +2 -2
  87. data/lib/zold/node/async_entrance.rb +2 -2
  88. data/lib/zold/node/entrance.rb +2 -2
  89. data/lib/zold/node/farm.rb +2 -2
  90. data/lib/zold/node/farmers.rb +2 -2
  91. data/lib/zold/node/front.rb +3 -3
  92. data/lib/zold/node/journaled_pipeline.rb +2 -2
  93. data/lib/zold/node/nodup_entrance.rb +2 -2
  94. data/lib/zold/node/nospam_entrance.rb +2 -2
  95. data/lib/zold/node/pipeline.rb +2 -2
  96. data/lib/zold/node/safe_entrance.rb +2 -2
  97. data/lib/zold/node/soft_error.rb +2 -2
  98. data/lib/zold/node/spread_entrance.rb +2 -2
  99. data/lib/zold/node/sync_entrance.rb +2 -2
  100. data/lib/zold/node/trace.rb +2 -2
  101. data/lib/zold/patch.rb +2 -2
  102. data/lib/zold/prefixes.rb +2 -2
  103. data/lib/zold/remotes.rb +2 -2
  104. data/lib/zold/signature.rb +2 -2
  105. data/lib/zold/size.rb +2 -2
  106. data/lib/zold/sync_wallets.rb +2 -2
  107. data/lib/zold/tax.rb +2 -2
  108. data/lib/zold/thread_pool.rb +2 -2
  109. data/lib/zold/tree_wallets.rb +2 -2
  110. data/lib/zold/txn.rb +2 -2
  111. data/lib/zold/txns.rb +3 -3
  112. data/lib/zold/upgrades.rb +1 -1
  113. data/lib/zold/verbose_thread.rb +2 -2
  114. data/lib/zold/version.rb +3 -3
  115. data/lib/zold/version_file.rb +1 -1
  116. data/lib/zold/wallet.rb +2 -2
  117. data/lib/zold/wallets.rb +2 -2
  118. data/lib/zold.rb +2 -2
  119. data/test/commands/routines/test_audit.rb +4 -4
  120. data/test/commands/routines/test_gc.rb +8 -8
  121. data/test/commands/routines/test_reconcile.rb +4 -4
  122. data/test/commands/routines/test_reconnect.rb +3 -3
  123. data/test/commands/routines/test_retire.rb +3 -3
  124. data/test/commands/test_alias.rb +26 -6
  125. data/test/commands/test_calculate.rb +3 -3
  126. data/test/commands/test_clean.rb +10 -10
  127. data/test/commands/test_create.rb +3 -3
  128. data/test/commands/test_diff.rb +5 -5
  129. data/test/commands/test_fetch.rb +9 -9
  130. data/test/commands/test_invoice.rb +3 -3
  131. data/test/commands/test_list.rb +3 -3
  132. data/test/commands/test_merge.rb +12 -12
  133. data/test/commands/test_node.rb +6 -6
  134. data/test/commands/test_pay.rb +19 -19
  135. data/test/commands/test_propagate.rb +5 -5
  136. data/test/commands/test_pull.rb +6 -6
  137. data/test/commands/test_push.rb +9 -9
  138. data/test/commands/test_remote.rb +11 -11
  139. data/test/commands/test_remove.rb +10 -10
  140. data/test/commands/test_show.rb +3 -3
  141. data/test/commands/test_taxes.rb +4 -4
  142. data/test/fake_home.rb +2 -2
  143. data/test/node/fake_entrance.rb +2 -2
  144. data/test/node/fake_node.rb +57 -40
  145. data/test/node/test_async_entrance.rb +10 -10
  146. data/test/node/test_entrance.rb +8 -8
  147. data/test/node/test_farm.rb +11 -11
  148. data/test/node/test_farmers.rb +5 -5
  149. data/test/node/test_front.rb +29 -28
  150. data/test/node/test_nodup_entrance.rb +4 -4
  151. data/test/node/test_nospam_entrance.rb +3 -3
  152. data/test/node/test_safe_entrance.rb +4 -4
  153. data/test/node/test_spread_entrance.rb +8 -8
  154. data/test/node/test_sync_entrance.rb +4 -4
  155. data/test/node/test_trace.rb +2 -2
  156. data/test/test__helper.rb +4 -4
  157. data/test/test_age.rb +2 -2
  158. data/test/test_amount.rb +2 -2
  159. data/test/test_cached_wallets.rb +2 -2
  160. data/test/test_copies.rb +12 -12
  161. data/test/test_dir_items.rb +4 -4
  162. data/test/test_gem.rb +20 -0
  163. data/test/test_hands.rb +2 -2
  164. data/test/test_hexnum.rb +2 -2
  165. data/test/test_http.rb +8 -8
  166. data/test/test_hungry_wallets.rb +11 -11
  167. data/test/test_id.rb +2 -2
  168. data/test/test_json_page.rb +2 -2
  169. data/test/test_key.rb +2 -2
  170. data/test/test_log.rb +5 -5
  171. data/test/test_metronome.rb +6 -6
  172. data/test/test_patch.rb +14 -14
  173. data/test/test_prefixes.rb +3 -3
  174. data/test/test_remotes.rb +9 -9
  175. data/test/test_signature.rb +2 -2
  176. data/test/test_size.rb +2 -2
  177. data/test/test_sync_wallets.rb +3 -3
  178. data/test/test_tax.rb +9 -9
  179. data/test/test_thread_pool.rb +8 -8
  180. data/test/test_tree_wallets.rb +2 -2
  181. data/test/test_txn.rb +2 -2
  182. data/test/test_upgrades.rb +2 -2
  183. data/test/test_verbose_thread.rb +2 -2
  184. data/test/test_version.rb +20 -0
  185. data/test/test_wallet.rb +22 -22
  186. data/test/test_wallets.rb +5 -5
  187. data/test/test_zold.rb +5 -5
  188. data/test/upgrades/test_delete_banned_wallets.rb +4 -4
  189. data/test/upgrades/test_protocol_up.rb +4 -4
  190. data/upgrades/2.rb +1 -1
  191. data/upgrades/delete_banned_wallets.rb +1 -1
  192. data/upgrades/move_wallets_into_tree.rb +1 -1
  193. data/upgrades/protocol_up.rb +1 -1
  194. data/upgrades/rename_foreign_wallets.rb +1 -1
  195. data/zold.gemspec +23 -23
  196. metadata +7 -3
data/lib/zold/tax.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -28,7 +28,7 @@ require_relative 'amount'
28
28
  # Tax transaction.
29
29
  #
30
30
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
31
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
32
32
  # License:: MIT
33
33
  module Zold
34
34
  # A single tax payment
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -26,7 +26,7 @@ require_relative 'verbose_thread'
26
26
 
27
27
  # Thread pool.
28
28
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
29
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
29
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
30
30
  # License:: MIT
31
31
  module Zold
32
32
  # Thread pool
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -26,7 +26,7 @@ require_relative 'dir_items'
26
26
 
27
27
  # The local collection of wallets.
28
28
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
29
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
29
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
30
30
  # License:: MIT
31
31
  module Zold
32
32
  # Collection of local wallets, in a tree of directories
data/lib/zold/txn.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -29,7 +29,7 @@ require_relative 'signature'
29
29
  # The transaction.
30
30
  #
31
31
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
32
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
32
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
33
33
  # License:: MIT
34
34
  module Zold
35
35
  # A single transaction
data/lib/zold/txns.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -24,7 +24,7 @@ require_relative 'txn'
24
24
 
25
25
  # Transactions in a wallet.
26
26
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
27
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
27
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
28
28
  # License:: MIT
29
29
  module Zold
30
30
  # A collection of transactions
@@ -60,7 +60,7 @@ module Zold
60
60
 
61
61
  # Cached transactions.
62
62
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
63
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
63
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
64
64
  # License:: MIT
65
65
  class CachedTxns
66
66
  def initialize(txns)
data/lib/zold/upgrades.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,7 +27,7 @@ require_relative 'size'
27
27
 
28
28
  # Verbose thread.
29
29
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
30
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
31
31
  # License:: MIT
32
32
  module Zold
33
33
  # Verbose thread
data/lib/zold/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -22,10 +22,10 @@
22
22
 
23
23
  # Zold main module.
24
24
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
25
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
25
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.31.8'
28
+ VERSION = '0.31.9'
29
29
  PROTOCOL = 2
30
30
  REPO = 'zold-io/zold'
31
31
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
data/lib/zold/wallet.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -42,7 +42,7 @@ require_relative 'head'
42
42
  # More details about its format is in README.md.
43
43
  #
44
44
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
45
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
45
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
46
46
  # License:: MIT
47
47
  module Zold
48
48
  # A single wallet
data/lib/zold/wallets.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -29,7 +29,7 @@ require_relative 'dir_items'
29
29
  # This class is not thread-safe!
30
30
  #
31
31
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
32
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
32
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
33
33
  # License:: MIT
34
34
  module Zold
35
35
  # Collection of local wallets
data/lib/zold.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -39,7 +39,7 @@ require_relative 'zold/version'
39
39
 
40
40
  # Zold main module.
41
41
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
42
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
42
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
43
43
  # License:: MIT
44
44
  module Zold
45
45
  # to be implemented...
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -28,13 +28,13 @@ require_relative '../../../lib/zold/commands/routines/audit'
28
28
 
29
29
  # Audit test.
30
30
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
31
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
32
32
  # License:: MIT
33
33
  class TestAudit < Zold::Test
34
34
  def test_audits
35
- FakeHome.new(log: test_log).run do |home|
35
+ FakeHome.new(log: fake_log).run do |home|
36
36
  opts = { 'routine-immediately' => true }
37
- routine = Zold::Routines::Audit.new(opts, home.wallets, log: test_log)
37
+ routine = Zold::Routines::Audit.new(opts, home.wallets, log: fake_log)
38
38
  routine.exec
39
39
  end
40
40
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -28,41 +28,41 @@ require_relative '../../../lib/zold/commands/routines/gc'
28
28
 
29
29
  # Gc test.
30
30
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
31
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
32
32
  # License:: MIT
33
33
  class TestGc < Zold::Test
34
34
  def test_collects_garbage
35
- FakeHome.new(log: test_log).run do |home|
35
+ FakeHome.new(log: fake_log).run do |home|
36
36
  wallets = home.wallets
37
37
  home.create_wallet
38
38
  opts = { 'routine-immediately' => true, 'gc-age' => 0 }
39
39
  assert_equal(1, wallets.count)
40
- routine = Zold::Routines::Gc.new(opts, wallets, log: test_log)
40
+ routine = Zold::Routines::Gc.new(opts, wallets, log: fake_log)
41
41
  routine.exec
42
42
  assert_equal(0, wallets.count)
43
43
  end
44
44
  end
45
45
 
46
46
  def test_doesnt_touch_non_empty_wallets
47
- FakeHome.new(log: test_log).run do |home|
47
+ FakeHome.new(log: fake_log).run do |home|
48
48
  wallets = home.wallets
49
49
  wallet = home.create_wallet
50
50
  amount = Zold::Amount.new(zld: 39.99)
51
51
  key = Zold::Key.new(file: 'fixtures/id_rsa')
52
52
  wallet.sub(amount, "NOPREFIX@#{Zold::Id.new}", key)
53
53
  opts = { 'routine-immediately' => true, 'gc-age' => 0 }
54
- routine = Zold::Routines::Gc.new(opts, wallets, log: test_log)
54
+ routine = Zold::Routines::Gc.new(opts, wallets, log: fake_log)
55
55
  routine.exec
56
56
  assert_equal(1, wallets.count)
57
57
  end
58
58
  end
59
59
 
60
60
  def test_doesnt_touch_fresh_wallets
61
- FakeHome.new(log: test_log).run do |home|
61
+ FakeHome.new(log: fake_log).run do |home|
62
62
  wallets = home.wallets
63
63
  home.create_wallet
64
64
  opts = { 'routine-immediately' => true, 'gc-age' => 60 * 60 }
65
- routine = Zold::Routines::Gc.new(opts, wallets, log: test_log)
65
+ routine = Zold::Routines::Gc.new(opts, wallets, log: fake_log)
66
66
  routine.exec
67
67
  assert_equal(1, wallets.count)
68
68
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -29,11 +29,11 @@ require_relative '../../../lib/zold/commands/routines/reconcile'
29
29
 
30
30
  # Reconcile test.
31
31
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
32
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
32
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
33
33
  # License:: MIT
34
34
  class TestReconcile < Zold::Test
35
35
  def test_reconciles
36
- FakeHome.new(log: test_log).run do |home|
36
+ FakeHome.new(log: fake_log).run do |home|
37
37
  remotes = home.remotes
38
38
  remotes.clean
39
39
  remotes.masters
@@ -43,7 +43,7 @@ class TestReconcile < Zold::Test
43
43
  stub_request(:get, "http://#{m[:host]}:#{m[:port]}/wallet/#{Zold::Id::ROOT}").to_return(status: 404)
44
44
  opts = { 'never-reboot' => true, 'routine-immediately' => true }
45
45
  routine = Zold::Routines::Reconcile.new(
46
- opts, home.wallets, remotes, home.copies.root, 'some-fake-host:2096', log: test_log
46
+ opts, home.wallets, remotes, home.copies.root, 'some-fake-host:2096', log: fake_log
47
47
  )
48
48
  routine.exec
49
49
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -29,7 +29,7 @@ require_relative '../../../lib/zold/commands/routines/reconnect'
29
29
 
30
30
  # Reconnect test.
31
31
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
32
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
32
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
33
33
  # License:: MIT
34
34
  class TestReconnect < Zold::Test
35
35
  def test_reconnects
@@ -39,7 +39,7 @@ class TestReconnect < Zold::Test
39
39
  remotes.add('localhost', 4096)
40
40
  stub_request(:get, 'http://localhost:4096/remotes').to_return(status: 404)
41
41
  opts = { 'never-reboot' => true, 'routine-immediately' => true }
42
- routine = Zold::Routines::Reconnect.new(opts, remotes, log: test_log)
42
+ routine = Zold::Routines::Reconnect.new(opts, remotes, log: fake_log)
43
43
  routine.exec
44
44
  end
45
45
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -29,12 +29,12 @@ require_relative '../../../lib/zold/commands/routines/retire'
29
29
 
30
30
  # Retire test.
31
31
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
32
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
32
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
33
33
  # License:: MIT
34
34
  class TestRetire < Zold::Test
35
35
  def test_retires
36
36
  opts = { 'never-reboot' => false, 'routine-immediately' => true }
37
- routine = Zold::Routines::Retire.new(opts, log: test_log)
37
+ routine = Zold::Routines::Retire.new(opts, log: fake_log)
38
38
  routine.exec(10 * 24 * 60)
39
39
  end
40
40
  end
@@ -1,5 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Copyright (c) 2018-2024 Zerocracy
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
3
23
  require 'minitest/autorun'
4
24
  require_relative '../test__helper'
5
25
  require_relative '../fake_home'
@@ -11,9 +31,9 @@ class TestAlias < Zold::Test
11
31
  # The syntax is already documented in the alias command in the help.
12
32
  def test_set_writes_alias_to_the_alias_file
13
33
  skip
14
- FakeHome.new(log: test_log).run do |home|
34
+ FakeHome.new(log: fake_log).run do |home|
15
35
  wallet = home.create_wallet
16
- Zold::Alias.new(wallets: home.wallets, log: test_log).run(%W[set #{wallet.id} my-alias])
36
+ Zold::Alias.new(wallets: home.wallets, log: fake_log).run(%W[set #{wallet.id} my-alias])
17
37
  assert_equal read_alias_file(home), %W[my-alias #{wallet.id}]
18
38
  end
19
39
  end
@@ -23,9 +43,9 @@ class TestAlias < Zold::Test
23
43
  # The syntax is already documented in the alias command in the help.
24
44
  def test_remove_removes_the_alias_from_the_alias_file
25
45
  skip
26
- FakeHome.new(log: test_log).run do |home|
46
+ FakeHome.new(log: fake_log).run do |home|
27
47
  wallet = home.create_wallet
28
- cmd = Zold::Alias.new(wallets: home.wallets, log: test_log)
48
+ cmd = Zold::Alias.new(wallets: home.wallets, log: fake_log)
29
49
  cmd.run(%W[set #{wallet.id} my-alias])
30
50
  assert_equal read_alias_file(home), %W[my-alias #{wallet.id}]
31
51
  cmd.run(%w[remove my-alias])
@@ -38,9 +58,9 @@ class TestAlias < Zold::Test
38
58
  # The syntax is already documented in the alias command in the help.
39
59
  def test_show_prints_out_the_aliased_wallet_id
40
60
  skip
41
- FakeHome.new(log: test_log).run do |home|
61
+ FakeHome.new(log: fake_log).run do |home|
42
62
  wallet = home.create_wallet
43
- cmd = Zold::Alias.new(wallets: home.wallets, log: test_log)
63
+ cmd = Zold::Alias.new(wallets: home.wallets, log: fake_log)
44
64
  cmd.run(%W[set #{wallet.id} my-alias])
45
65
  assert_equal read_alias_file(home), %W[my-alias #{wallet.id}]
46
66
  stdout, = capture_io { cmd.run(%w[show my-alias]) }
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -27,11 +27,11 @@ require_relative '../../lib/zold/commands/calculate'
27
27
 
28
28
  # SCORE test.
29
29
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
30
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
30
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
31
31
  # License:: MIT
32
32
  class TestCalculate < Zold::Test
33
33
  def test_calculates_score
34
- score = Zold::Calculate.new(log: test_log).run(
34
+ score = Zold::Calculate.new(log: fake_log).run(
35
35
  ['score', '--strength=2', '--max=8', '--invoice=NOSUFFIX@ffffffffffffffff']
36
36
  )
37
37
  assert(score.valid?)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -30,42 +30,42 @@ require_relative '../../lib/zold/commands/clean'
30
30
 
31
31
  # CLEAN test.
32
32
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
33
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
33
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
34
34
  # License:: MIT
35
35
  class TestClean < Zold::Test
36
36
  def test_cleans_copies
37
- FakeHome.new(log: test_log).run do |home|
37
+ FakeHome.new(log: fake_log).run do |home|
38
38
  wallet = home.create_wallet
39
39
  copies = home.copies(wallet)
40
40
  copies.add('a1', 'host-1', 80, 1, time: Time.now - (26 * 60 * 60))
41
41
  copies.add('a2', 'host-2', 80, 2, time: Time.now - (26 * 60 * 60))
42
- Zold::Clean.new(wallets: home.wallets, copies: copies.root, log: test_log).run(['clean', wallet.id.to_s])
42
+ Zold::Clean.new(wallets: home.wallets, copies: copies.root, log: fake_log).run(['clean', wallet.id.to_s])
43
43
  assert(copies.all.empty?)
44
44
  end
45
45
  end
46
46
 
47
47
  def test_clean_no_copies
48
- FakeHome.new(log: test_log).run do |home|
48
+ FakeHome.new(log: fake_log).run do |home|
49
49
  wallet = home.create_wallet
50
50
  copies = home.copies(wallet)
51
- Zold::Clean.new(wallets: home.wallets, copies: copies.root, log: test_log).run(['clean'])
51
+ Zold::Clean.new(wallets: home.wallets, copies: copies.root, log: fake_log).run(['clean'])
52
52
  assert(copies.all.empty?)
53
53
  end
54
54
  end
55
55
 
56
56
  def test_cleans_empty_wallets
57
- FakeHome.new(log: test_log).run do |home|
58
- Zold::Clean.new(wallets: home.wallets, copies: File.join(home.dir, 'c'), log: test_log).run(['clean'])
57
+ FakeHome.new(log: fake_log).run do |home|
58
+ Zold::Clean.new(wallets: home.wallets, copies: File.join(home.dir, 'c'), log: fake_log).run(['clean'])
59
59
  end
60
60
  end
61
61
 
62
62
  def test_cleans_copies_in_threads
63
- FakeHome.new(log: test_log).run do |home|
63
+ FakeHome.new(log: fake_log).run do |home|
64
64
  wallet = home.create_wallet
65
65
  copies = home.copies(wallet)
66
66
  copies.add(File.read(wallet.path), 'host-2', 80, 2, time: Time.now)
67
67
  Threads.new(20).assert do
68
- Zold::Clean.new(wallets: home.wallets, copies: copies.root, log: test_log).run(['clean'])
68
+ Zold::Clean.new(wallets: home.wallets, copies: copies.root, log: fake_log).run(['clean'])
69
69
  end
70
70
  assert_equal(1, copies.all.count)
71
71
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -29,13 +29,13 @@ require_relative '../../lib/zold/commands/create'
29
29
 
30
30
  # CREATE test.
31
31
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
32
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
32
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
33
33
  # License:: MIT
34
34
  class TestCreate < Zold::Test
35
35
  def test_creates_wallet
36
36
  Dir.mktmpdir do |dir|
37
37
  wallets = Zold::Wallets.new(dir)
38
- id = Zold::Create.new(wallets: wallets, remotes: nil, log: test_log).run(
38
+ id = Zold::Create.new(wallets: wallets, remotes: nil, log: fake_log).run(
39
39
  ['create', '--public-key=fixtures/id_rsa.pub', '--skip-test']
40
40
  )
41
41
  wallets.acq(id) do |wallet|
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -36,23 +36,23 @@ require_relative '../../lib/zold/commands/diff'
36
36
 
37
37
  # DIFF test.
38
38
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
39
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
39
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
40
40
  # License:: MIT
41
41
  class TestDiff < Zold::Test
42
42
  def test_diff_with_copies
43
- FakeHome.new(log: test_log).run do |home|
43
+ FakeHome.new(log: fake_log).run do |home|
44
44
  wallet = home.create_wallet
45
45
  first = home.create_wallet
46
46
  File.write(first.path, File.read(wallet.path))
47
47
  second = home.create_wallet
48
48
  File.write(second.path, File.read(wallet.path))
49
- Zold::Pay.new(wallets: home.wallets, copies: home.dir, remotes: home.remotes, log: test_log).run(
49
+ Zold::Pay.new(wallets: home.wallets, copies: home.dir, remotes: home.remotes, log: fake_log).run(
50
50
  ['pay', wallet.id.to_s, "NOPREFIX@#{Zold::Id.new}", '14.95', '--force', '--private-key=fixtures/id_rsa']
51
51
  )
52
52
  copies = home.copies(wallet)
53
53
  copies.add(File.read(first.path), 'host-1', 80, 5)
54
54
  copies.add(File.read(second.path), 'host-2', 80, 5)
55
- diff = Zold::Diff.new(wallets: home.wallets, copies: copies.root, log: test_log).run(
55
+ diff = Zold::Diff.new(wallets: home.wallets, copies: copies.root, log: fake_log).run(
56
56
  ['diff', wallet.id.to_s]
57
57
  )
58
58
  assert(diff.include?('-0001;'), diff)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright (c) 2018-2023 Zerocracy
3
+ # Copyright (c) 2018-2024 Zerocracy
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the 'Software'), to deal
@@ -38,11 +38,11 @@ require_relative '../../lib/zold/commands/fetch'
38
38
 
39
39
  # FETCH test.
40
40
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
41
- # Copyright:: Copyright (c) 2018 Yegor Bugayenko
41
+ # Copyright:: Copyright (c) 2018-2024 Zerocracy
42
42
  # License:: MIT
43
43
  class TestFetch < Zold::Test
44
44
  def test_fetches_wallet
45
- FakeHome.new(log: test_log).run do |home|
45
+ FakeHome.new(log: fake_log).run do |home|
46
46
  wallet = home.create_wallet
47
47
  stub_request(:get, "http://localhost:4096/wallet/#{wallet.id}").to_return(
48
48
  status: 200,
@@ -59,7 +59,7 @@ class TestFetch < Zold::Test
59
59
  remotes.add('localhost', 4096)
60
60
  remotes.add('localhost', 81)
61
61
  copies = home.copies(wallet)
62
- Zold::Fetch.new(wallets: home.wallets, copies: copies.root, remotes: remotes, log: test_log).run(
62
+ Zold::Fetch.new(wallets: home.wallets, copies: copies.root, remotes: remotes, log: fake_log).run(
63
63
  ['fetch', '--tolerate-edges', '--tolerate-quorum=1', '--ignore-score-weakness', wallet.id.to_s]
64
64
  )
65
65
  assert_equal(1, copies.all.count)
@@ -69,7 +69,7 @@ class TestFetch < Zold::Test
69
69
  end
70
70
 
71
71
  def test_fetches_multiple_wallets
72
- log = TestLogger.new(test_log)
72
+ log = TestLogger.new(fake_log)
73
73
  FakeHome.new(log: log).run do |home|
74
74
  wallet_a = home.create_wallet
75
75
  stub_request(:get, "http://localhost:4096/wallet/#{wallet_a.id}").to_return(
@@ -113,7 +113,7 @@ class TestFetch < Zold::Test
113
113
  end
114
114
 
115
115
  def test_fails_when_only_edge_nodes
116
- FakeHome.new(log: test_log).run do |home|
116
+ FakeHome.new(log: fake_log).run do |home|
117
117
  wallet = home.create_wallet
118
118
  stub_request(:get, "http://localhost:4096/wallet/#{wallet.id}").to_return(
119
119
  status: 200,
@@ -129,7 +129,7 @@ class TestFetch < Zold::Test
129
129
  remotes.add('localhost', 4096)
130
130
  copies = home.copies(wallet)
131
131
  assert_raises Zold::Fetch::EdgesOnly do
132
- Zold::Fetch.new(wallets: home.wallets, copies: copies.root, remotes: remotes, log: test_log).run(
132
+ Zold::Fetch.new(wallets: home.wallets, copies: copies.root, remotes: remotes, log: fake_log).run(
133
133
  ['fetch', '--ignore-score-weakness', wallet.id.to_s]
134
134
  )
135
135
  end
@@ -137,7 +137,7 @@ class TestFetch < Zold::Test
137
137
  end
138
138
 
139
139
  def test_fails_when_only_one_node
140
- FakeHome.new(log: test_log).run do |home|
140
+ FakeHome.new(log: fake_log).run do |home|
141
141
  wallet = home.create_wallet
142
142
  stub_request(:get, "http://localhost:4096/wallet/#{wallet.id}").to_return(
143
143
  status: 200,
@@ -153,7 +153,7 @@ class TestFetch < Zold::Test
153
153
  remotes.add('localhost', 4096)
154
154
  copies = home.copies(wallet)
155
155
  assert_raises Zold::Fetch::NoQuorum do
156
- Zold::Fetch.new(wallets: home.wallets, copies: copies.root, remotes: remotes, log: test_log).run(
156
+ Zold::Fetch.new(wallets: home.wallets, copies: copies.root, remotes: remotes, log: fake_log).run(
157
157
  ['fetch', '--tolerate-edges', '--ignore-score-weakness', wallet.id.to_s]
158
158
  )
159
159
  end