MCPcopy Create free account
hub / github.com/cloudbase/garm / TestGetLabelsForInstance

Method TestGetLabelsForInstance

runner/metadata_test.go:283–301  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

281}
282
283func (s *MetadataTestSuite) TestGetLabelsForInstance() {
284 // Test with regular instance
285 // Since we can't easily set up the cache in tests, labels might be empty
286 // but the function should not panic
287 labels := getLabelsForInstance(s.Fixtures.TestInstance)
288 s.Require().NotNil(labels) // Should return a slice, even if empty
289
290 // Test with JIT instance (should return empty labels)
291 jitInstance := s.Fixtures.TestInstance
292 jitInstance.JitConfiguration = map[string]string{"test": "config"}
293 jitLabels := getLabelsForInstance(jitInstance)
294 s.Require().Empty(jitLabels)
295
296 // Test with scale set instance (should return empty labels)
297 scaleSetInstance := s.Fixtures.TestInstance
298 scaleSetInstance.ScaleSetID = 123
299 scaleSetLabels := getLabelsForInstance(scaleSetInstance)
300 s.Require().Empty(scaleSetLabels)
301}
302
303func (s *MetadataTestSuite) TestGetRunnerInstallScript() {
304 // Set up github tools cache for the entity

Callers

nothing calls this directly

Calls 1

getLabelsForInstanceFunction · 0.85

Tested by

no test coverage detected