()
| 1230 | } |
| 1231 | |
| 1232 | func (c *CacheTestSuite) TestGetEntityForInstanceWithPool() { |
| 1233 | entity := params.ForgeEntity{ |
| 1234 | ID: "test-entity", |
| 1235 | EntityType: params.ForgeEntityTypeOrganization, |
| 1236 | Name: "test-org", |
| 1237 | Owner: "test-owner", |
| 1238 | } |
| 1239 | pool := params.Pool{ |
| 1240 | ID: "pool-1", |
| 1241 | OrgID: "test-entity", |
| 1242 | } |
| 1243 | instance := params.Instance{ |
| 1244 | Name: "test-instance", |
| 1245 | PoolID: "pool-1", |
| 1246 | } |
| 1247 | |
| 1248 | SetEntity(entity) |
| 1249 | SetEntityPool(entity.ID, pool) |
| 1250 | SetInstanceCache(instance) |
| 1251 | |
| 1252 | retrievedEntity, ok := GetEntityForInstance("test-instance") |
| 1253 | c.Require().True(ok) |
| 1254 | c.Require().Equal(entity.ID, retrievedEntity.ID) |
| 1255 | c.Require().Equal(entity.Name, retrievedEntity.Name) |
| 1256 | c.Require().Equal(entity.Owner, retrievedEntity.Owner) |
| 1257 | c.Require().Equal(entity.EntityType, retrievedEntity.EntityType) |
| 1258 | |
| 1259 | nonExistentEntity, ok := GetEntityForInstance("non-existent-instance") |
| 1260 | c.Require().False(ok) |
| 1261 | c.Require().Equal(params.ForgeEntity{}, nonExistentEntity) |
| 1262 | } |
| 1263 | |
| 1264 | func (c *CacheTestSuite) TestGetEntityForInstanceWithScaleSet() { |
| 1265 | entity := params.ForgeEntity{ |
nothing calls this directly
no test coverage detected