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

Method TestGetEntityForPool

cache/cache_test.go:1057–1080  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1055}
1056
1057func (c *CacheTestSuite) TestGetEntityForPool() {
1058 entity := params.ForgeEntity{
1059 ID: "test-entity",
1060 EntityType: params.ForgeEntityTypeOrganization,
1061 Name: "test",
1062 Owner: "test",
1063 }
1064 pool := params.Pool{
1065 ID: "pool-1",
1066 OrgID: "test-entity", // Set the org ID to match the entity
1067 }
1068
1069 SetEntity(entity)
1070 SetEntityPool(entity.ID, pool)
1071
1072 retrievedEntity, ok := GetEntityForPool(pool.ID)
1073 c.Require().True(ok)
1074 c.Require().Equal(entity.ID, retrievedEntity.ID)
1075 c.Require().Equal(entity.Name, retrievedEntity.Name)
1076
1077 nonExistentEntity, ok := GetEntityForPool("non-existent-pool")
1078 c.Require().False(ok)
1079 c.Require().Equal(params.ForgeEntity{}, nonExistentEntity)
1080}
1081
1082func (c *CacheTestSuite) TestGetEntityForScaleSet() {
1083 entity := params.ForgeEntity{

Callers

nothing calls this directly

Calls 3

SetEntityFunction · 0.85
SetEntityPoolFunction · 0.85
GetEntityForPoolFunction · 0.85

Tested by

no test coverage detected