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

Method TestGetEntityForScaleSet

cache/cache_test.go:1082–1105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1080}
1081
1082func (c *CacheTestSuite) TestGetEntityForScaleSet() {
1083 entity := params.ForgeEntity{
1084 ID: "test-entity",
1085 EntityType: params.ForgeEntityTypeOrganization,
1086 Name: "test",
1087 Owner: "test",
1088 }
1089 scaleSet := params.ScaleSet{
1090 ID: 1,
1091 OrgID: "test-entity", // Set the org ID to match the entity
1092 }
1093
1094 SetEntity(entity)
1095 SetEntityScaleSet(entity.ID, scaleSet)
1096
1097 retrievedEntity, ok := GetEntityForScaleSet(scaleSet.ID)
1098 c.Require().True(ok)
1099 c.Require().Equal(entity.ID, retrievedEntity.ID)
1100 c.Require().Equal(entity.Name, retrievedEntity.Name)
1101
1102 nonExistentEntity, ok := GetEntityForScaleSet(999)
1103 c.Require().False(ok)
1104 c.Require().Equal(params.ForgeEntity{}, nonExistentEntity)
1105}
1106
1107func (c *CacheTestSuite) TestGetPoolByID() {
1108 entity := params.ForgeEntity{

Callers

nothing calls this directly

Calls 3

SetEntityFunction · 0.85
SetEntityScaleSetFunction · 0.85
GetEntityForScaleSetFunction · 0.85

Tested by

no test coverage detected