puppet_forge 5.0.1 → 5.0.2
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/CHANGELOG.md +4 -0
- data/lib/puppet_forge/lru_cache.rb +1 -1
- data/lib/puppet_forge/version.rb +1 -1
- data/spec/unit/forge/lru_cache_spec.rb +44 -22
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 173cc16e95da2ae090f719e7d6b1ff2e86f444c27f8c88ada965047e7c24afcc
|
4
|
+
data.tar.gz: 97b40c77169ce1c3f67fcf1ea70e48d8738e9623c3a9a76aa451e493b316b1ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cea98cd9ec0b7a20f385c61b3f1776067eea4c4345dfc1d20ed274813d24a0d46af80109e709d57014e2cad09cd765ada4e82902cc1c3d3a698f0906453c7bb
|
7
|
+
data.tar.gz: a6bf1839d69b0bd3404c104e6621fe77e29c6e89cedc5ca19b0cdf78c9750ce60bb1cbc5879b23fd807f477b6731c281b6c830da3a48a11ad4fb6845dd1c899d
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
Starting with v2.0.0, all notable changes to this project will be documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## v5.0.2 - 2023-09-29
|
7
|
+
* Correct a Digest call making this thread-safe and allowing for concurrent r10k deploys.
|
8
|
+
Thanks to @cmd-ntrf for fixing it and to @baurmatt for tracking it down in the first place.
|
9
|
+
|
6
10
|
## v5.0.1 - 2023-07-10
|
7
11
|
* Update README to reflect accurate Ruby requirement and `faraday` gem dependency
|
8
12
|
## v5.0.0 - 2023-05-07
|
@@ -9,7 +9,7 @@ module PuppetForge
|
|
9
9
|
# a convenience method for generating cache keys. Cache keys do not
|
10
10
|
# have to be SHA256 hashes, but they must be unique.
|
11
11
|
def self.new_key(*string_args)
|
12
|
-
Digest
|
12
|
+
Digest(:SHA256).hexdigest(string_args.map(&:to_s).join(':'))
|
13
13
|
end
|
14
14
|
|
15
15
|
# @return [Integer] the maximum number of items to cache.
|
data/lib/puppet_forge/version.rb
CHANGED
@@ -67,18 +67,26 @@ describe PuppetForge::LruCache do
|
|
67
67
|
expect(cache.send(:lru)).to eq(['foo', 'baz'])
|
68
68
|
end
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
70
|
+
it 'is thread-safe for get calls' do
|
71
|
+
cache = PuppetForge::LruCache.new
|
72
|
+
|
73
|
+
# Populate the cache with initial values
|
74
|
+
cache.put('foo', 'bar')
|
75
|
+
cache.put('baz', 'qux')
|
76
|
+
|
77
|
+
# Create two threads for concurrent cache get operations
|
78
|
+
thread_one = Thread.new do
|
79
|
+
100.times { expect(cache.get('foo')).to eq('bar') }
|
80
|
+
end
|
81
|
+
|
82
|
+
thread_two = Thread.new do
|
83
|
+
100.times { expect(cache.get('baz')).to eq('qux') }
|
84
|
+
end
|
85
|
+
|
86
|
+
# Wait for both threads to complete
|
87
|
+
thread_one.join
|
88
|
+
thread_two.join
|
89
|
+
end
|
82
90
|
end
|
83
91
|
|
84
92
|
context '#put' do
|
@@ -102,16 +110,30 @@ describe PuppetForge::LruCache do
|
|
102
110
|
expect(cache.send(:lru)).to eq(['quux', 'baz'])
|
103
111
|
end
|
104
112
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
113
|
+
it 'is thread-safe' do
|
114
|
+
cache = PuppetForge::LruCache.new
|
115
|
+
|
116
|
+
# Create two threads for concurrent cache operations
|
117
|
+
thread_one = Thread.new do
|
118
|
+
100.times { cache.put('foo', 'bar') }
|
119
|
+
end
|
120
|
+
|
121
|
+
thread_two = Thread.new do
|
122
|
+
100.times { cache.put('baz', 'qux') }
|
123
|
+
end
|
124
|
+
|
125
|
+
# Wait for both threads to complete
|
126
|
+
thread_one.join
|
127
|
+
thread_two.join
|
128
|
+
|
129
|
+
# At this point, we don't need to compare the LRU list,
|
130
|
+
# because the order may change due to concurrent puts.
|
131
|
+
|
132
|
+
# Instead, we simply expect the code to run without errors.
|
133
|
+
expect { thread_one.value }.not_to raise_error
|
134
|
+
expect { thread_two.value }.not_to raise_error
|
135
|
+
end
|
136
|
+
|
115
137
|
end
|
116
138
|
|
117
139
|
context '#clear' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet_forge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -253,7 +253,7 @@ homepage: https://github.com/puppetlabs/forge-ruby
|
|
253
253
|
licenses:
|
254
254
|
- Apache-2.0
|
255
255
|
metadata: {}
|
256
|
-
post_install_message:
|
256
|
+
post_install_message:
|
257
257
|
rdoc_options: []
|
258
258
|
require_paths:
|
259
259
|
- lib
|
@@ -268,8 +268,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
268
|
- !ruby/object:Gem::Version
|
269
269
|
version: '0'
|
270
270
|
requirements: []
|
271
|
-
rubygems_version: 3.
|
272
|
-
signing_key:
|
271
|
+
rubygems_version: 3.3.7
|
272
|
+
signing_key:
|
273
273
|
specification_version: 4
|
274
274
|
summary: Access the Puppet Forge API from Ruby for resource information and to download
|
275
275
|
releases.
|