File tree Expand file tree Collapse file tree 1 file changed +0
-29
lines changed Expand file tree Collapse file tree 1 file changed +0
-29
lines changed Original file line number Diff line number Diff line change 132
132
expect ( described_class . extra_component_names ) . to be_empty
133
133
end
134
134
end
135
-
136
- describe "thread safety" do
137
- it "handles concurrent access to user components safely" do
138
- threads = [ ]
139
- results = [ ]
140
- mutex = Mutex . new
141
-
142
- # Start multiple threads that register and access components concurrently
143
- 10 . times do |i |
144
- threads << Thread . new do
145
- # Each thread registers a component with a unique name
146
- described_class . register_extra_components ( { "component_#{ i } " : "value_#{ i } " } )
147
-
148
- # Then tries to read it back
149
- value = described_class . get_extra_component ( "component_#{ i } " )
150
- mutex . synchronize { results << value }
151
- end
152
- end
153
-
154
- # Wait for all threads to complete
155
- threads . each ( &:join )
156
-
157
- # Verify all components were registered and retrieved correctly
158
- expect ( results . size ) . to eq ( 10 )
159
- results . each_with_index do |result , i |
160
- expect ( result ) . to eq ( "value_#{ i } " )
161
- end
162
- end
163
- end
164
135
end
You can’t perform that action at this time.
0 commit comments