@@ -118,55 +118,45 @@ def self.configure(chef_run)
118
118
end
119
119
120
120
describe 'fabric_manager:_fabric_manager_enabled' do
121
- for_all_oses do |platform , version |
122
- context "on #{ platform } #{ version } " do
123
- context 'when on arm' do
124
- cached ( :chef_run ) do
125
- allow_any_instance_of ( Object ) . to receive ( :arm_instance? ) . and_return ( true )
126
- ChefSpec ::SoloRunner . new ( step_into : [ 'fabric_manager' ] , platform : platform , version : version )
127
- end
128
- cached ( :resource ) do
129
- ConvergeFabricManager . setup ( chef_run , nvidia_enabled : true )
130
- chef_run . find_resource ( 'fabric_manager' , 'setup' )
131
- end
132
- if platform == 'amazon' && version == '2'
133
- it "is not enabled" do
134
- expect ( resource . _fabric_manager_enabled ) . to eq ( false )
135
- end
136
- else
137
- it "is enabled" do
138
- expect ( resource . _fabric_manager_enabled ) . to eq ( true )
139
- end
140
- end
141
- end
121
+ context 'when on arm' do
122
+ cached ( :chef_run ) do
123
+ allow_any_instance_of ( Object ) . to receive ( :arm_instance? ) . and_return ( true )
124
+ ChefSpec ::SoloRunner . new ( step_into : [ 'fabric_manager' ] )
125
+ end
126
+ cached ( :resource ) do
127
+ ConvergeFabricManager . setup ( chef_run , nvidia_enabled : true )
128
+ chef_run . find_resource ( 'fabric_manager' , 'setup' )
129
+ end
130
+ it "is not enabled" do
131
+ expect ( resource . _fabric_manager_enabled ) . to eq ( false )
132
+ end
133
+ end
142
134
143
- context 'when not on arm' do
144
- cached ( :chef_run ) do
145
- allow_any_instance_of ( Object ) . to receive ( :arm_instance? ) . and_return ( false )
146
- ChefSpec ::SoloRunner . new ( step_into : [ 'fabric_manager' ] )
147
- end
135
+ context 'when not on arm' do
136
+ cached ( :chef_run ) do
137
+ allow_any_instance_of ( Object ) . to receive ( :arm_instance? ) . and_return ( false )
138
+ ChefSpec ::SoloRunner . new ( step_into : [ 'fabric_manager' ] )
139
+ end
148
140
149
- context 'when nvidia enabled' do
150
- cached ( :resource ) do
151
- ConvergeFabricManager . setup ( chef_run , nvidia_enabled : true )
152
- chef_run . find_resource ( 'fabric_manager' , 'setup' )
153
- end
141
+ context 'when nvidia enabled' do
142
+ cached ( :resource ) do
143
+ ConvergeFabricManager . setup ( chef_run , nvidia_enabled : true )
144
+ chef_run . find_resource ( 'fabric_manager' , 'setup' )
145
+ end
154
146
155
- it "is enabled" do
156
- expect ( resource . _fabric_manager_enabled ) . to eq ( true )
157
- end
158
- end
147
+ it "is enabled" do
148
+ expect ( resource . _fabric_manager_enabled ) . to eq ( true )
149
+ end
150
+ end
159
151
160
- context 'when nvidia not enabled' do
161
- cached ( :resource ) do
162
- ConvergeFabricManager . setup ( chef_run , nvidia_enabled : false )
163
- chef_run . find_resource ( 'fabric_manager' , 'setup' )
164
- end
152
+ context 'when nvidia not enabled' do
153
+ cached ( :resource ) do
154
+ ConvergeFabricManager . setup ( chef_run , nvidia_enabled : false )
155
+ chef_run . find_resource ( 'fabric_manager' , 'setup' )
156
+ end
165
157
166
- it "is not enabled" do
167
- expect ( resource . _fabric_manager_enabled ) . to eq ( false )
168
- end
169
- end
158
+ it "is not enabled" do
159
+ expect ( resource . _fabric_manager_enabled ) . to eq ( false )
170
160
end
171
161
end
172
162
end
@@ -227,44 +217,60 @@ def self.configure(chef_run)
227
217
end
228
218
229
219
describe 'fabric_manager:configure' do
220
+ let ( :output_of_shell ) { double ( 'shell_out' ) }
230
221
cached ( :nvidia_driver_version ) { 'nvidia_driver_version' }
231
-
232
- for_all_oses do |platform , version |
233
- context "on #{ platform } #{ version } " do
234
- cached ( :fabric_manager_package ) { platform == 'ubuntu' ? 'nvidia-fabricmanager-535' : 'nvidia-fabric-manager' }
235
- cached ( :fabric_manager_version ) { platform == 'ubuntu' ? "#{ nvidia_driver_version } " : nvidia_driver_version }
236
-
237
- context ( 'when nvswithes are > 1' ) do
238
- cached ( :chef_run ) do
239
- stubs_for_resource ( 'fabric_manager' ) do |res |
240
- allow ( res ) . to receive ( :get_nvswitches ) . and_return ( 2 )
222
+ [ true , false ] . each do |is_gb200 |
223
+ for_all_oses do |platform , version |
224
+ context "on #{ platform } #{ version } on #{ is_gb200 } gb200 node" do
225
+ cached ( :fabric_manager_package ) { platform == 'ubuntu' ? 'nvidia-fabricmanager-535' : 'nvidia-fabric-manager' }
226
+ cached ( :fabric_manager_version ) { platform == 'ubuntu' ? "#{ nvidia_driver_version } " : nvidia_driver_version }
227
+
228
+ context ( 'when nvswithes are > 1' ) do
229
+ cached ( :chef_run ) do
230
+ stubs_for_provider ( 'fabric_manager' ) do |res |
231
+ allow ( res ) . to receive ( :get_nvswitches ) . and_return ( 2 )
232
+ allow ( res ) . to receive ( :get_device_ids ) . and_return ( { 'gb200' => 'test' } )
233
+ allow ( res ) . to receive ( :is_gb200_node? ) . and_return ( is_gb200 )
234
+ allow ( res ) . to receive ( :shell_out ) . and_return ( output_of_shell )
235
+ end
236
+ runner = runner ( platform : platform , version : version , step_into : [ 'fabric_manager' ] )
237
+ ConvergeFabricManager . configure ( runner )
241
238
end
242
- runner = runner ( platform : platform , version : version , step_into : [ 'fabric_manager' ] )
243
- ConvergeFabricManager . configure ( runner )
244
- end
245
239
246
- it 'configures fabric manager' do
247
- is_expected . to configure_fabric_manager ( 'configure' )
248
- end
240
+ it 'configures fabric manager' do
241
+ is_expected . to configure_fabric_manager ( 'configure' )
242
+ end
249
243
250
- it 'starts nvidia-fabricmanager service' do
251
- is_expected . to start_service ( 'nvidia-fabricmanager' )
252
- . with_action ( %i( start enable ) )
253
- . with_supports ( { status : true } )
244
+ if is_gb200
245
+ it 'does not start nvidia-fabricmanager service' do
246
+ is_expected . not_to start_service ( 'nvidia-fabricmanager' )
247
+ . with_action ( %i( start enable ) )
248
+ . with_supports ( { status : true } )
249
+ end
250
+ else
251
+ it 'starts nvidia-fabricmanager service' do
252
+ is_expected . to start_service ( 'nvidia-fabricmanager' )
253
+ . with_action ( %i( start enable ) )
254
+ . with_supports ( { status : true } )
255
+ end
256
+ end
254
257
end
255
- end
256
258
257
- context ( 'when nvswithes are not > 1' ) do
258
- cached ( :chef_run ) do
259
- stubs_for_resource ( 'fabric_manager' ) do |res |
260
- allow ( res ) . to receive ( :get_nvswitches ) . and_return ( 1 )
259
+ context ( 'when nvswithes are not > 1' ) do
260
+ cached ( :chef_run ) do
261
+ stubs_for_provider ( 'fabric_manager[configure]' ) do |res |
262
+ allow ( res ) . to receive ( :get_nvswitches ) . and_return ( 1 )
263
+ allow ( res ) . to receive ( :get_device_ids ) . and_return ( { 'gb200' => 'test' } )
264
+ allow ( res ) . to receive ( :is_gb200_node? ) . and_return ( is_gb200 )
265
+ allow ( res ) . to receive ( :shell_out ) . and_return ( output_of_shell )
266
+ end
267
+ runner = runner ( platform : platform , version : version , step_into : [ 'fabric_manager' ] )
268
+ ConvergeFabricManager . configure ( runner )
261
269
end
262
- runner = runner ( platform : platform , version : version , step_into : [ 'fabric_manager' ] )
263
- ConvergeFabricManager . configure ( runner )
264
- end
265
270
266
- it "doesn't start nvidia-fabricmanager service" do
267
- is_expected . not_to start_service ( 'nvidia-fabricmanager' )
271
+ it "doesn't start nvidia-fabricmanager service" do
272
+ is_expected . not_to start_service ( 'nvidia-fabricmanager' )
273
+ end
268
274
end
269
275
end
270
276
end
0 commit comments