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

Method TestGetScaleSetByIDWithMultipleScaleSets

cache/cache_test.go:1199–1230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1197}
1198
1199func (c *CacheTestSuite) TestGetScaleSetByIDWithMultipleScaleSets() {
1200 entity := params.ForgeEntity{
1201 ID: "test-entity",
1202 EntityType: params.ForgeEntityTypeOrganization,
1203 Name: "test",
1204 Owner: "test",
1205 }
1206 scaleSet1 := params.ScaleSet{
1207 ID: 1,
1208 Enabled: true,
1209 OrgID: "test-entity",
1210 }
1211 scaleSet2 := params.ScaleSet{
1212 ID: 2,
1213 Enabled: false,
1214 OrgID: "test-entity",
1215 }
1216
1217 SetEntity(entity)
1218 SetEntityScaleSet(entity.ID, scaleSet1)
1219 SetEntityScaleSet(entity.ID, scaleSet2)
1220
1221 retrievedScaleSet1, ok := GetScaleSetByID(1)
1222 c.Require().True(ok)
1223 c.Require().Equal(uint(1), retrievedScaleSet1.ID)
1224 c.Require().True(retrievedScaleSet1.Enabled)
1225
1226 retrievedScaleSet2, ok := GetScaleSetByID(2)
1227 c.Require().True(ok)
1228 c.Require().Equal(uint(2), retrievedScaleSet2.ID)
1229 c.Require().False(retrievedScaleSet2.Enabled)
1230}
1231
1232func (c *CacheTestSuite) TestGetEntityForInstanceWithPool() {
1233 entity := params.ForgeEntity{

Callers

nothing calls this directly

Calls 3

SetEntityFunction · 0.85
SetEntityScaleSetFunction · 0.85
GetScaleSetByIDFunction · 0.85

Tested by

no test coverage detected