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

Method TestGetEntityForInstanceWithScaleSet

cache/cache_test.go:1264–1290  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1262}
1263
1264func (c *CacheTestSuite) TestGetEntityForInstanceWithScaleSet() {
1265 entity := params.ForgeEntity{
1266 ID: "test-entity",
1267 EntityType: params.ForgeEntityTypeOrganization,
1268 Name: "test-org",
1269 Owner: "test-owner",
1270 }
1271 scaleSet := params.ScaleSet{
1272 ID: 1,
1273 OrgID: "test-entity",
1274 }
1275 instance := params.Instance{
1276 Name: "test-instance",
1277 ScaleSetID: 1,
1278 }
1279
1280 SetEntity(entity)
1281 SetEntityScaleSet(entity.ID, scaleSet)
1282 SetInstanceCache(instance)
1283
1284 retrievedEntity, ok := GetEntityForInstance("test-instance")
1285 c.Require().True(ok)
1286 c.Require().Equal(entity.ID, retrievedEntity.ID)
1287 c.Require().Equal(entity.Name, retrievedEntity.Name)
1288 c.Require().Equal(entity.Owner, retrievedEntity.Owner)
1289 c.Require().Equal(entity.EntityType, retrievedEntity.EntityType)
1290}
1291
1292func (c *CacheTestSuite) TestGetEntityForInstanceWithRepositoryEntity() {
1293 entity := params.ForgeEntity{

Callers

nothing calls this directly

Calls 4

SetEntityFunction · 0.85
SetEntityScaleSetFunction · 0.85
SetInstanceCacheFunction · 0.85
GetEntityForInstanceFunction · 0.85

Tested by

no test coverage detected