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

Method TestGetPoolByID

cache/cache_test.go:1107–1138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1105}
1106
1107func (c *CacheTestSuite) TestGetPoolByID() {
1108 entity := params.ForgeEntity{
1109 ID: "test-entity",
1110 EntityType: params.ForgeEntityTypeOrganization,
1111 Name: "test",
1112 Owner: "test",
1113 }
1114 pool := params.Pool{
1115 ID: "pool-1",
1116 OrgID: "test-entity",
1117 Enabled: true,
1118 Tags: []params.Tag{
1119 {
1120 Name: "test-tag",
1121 },
1122 },
1123 }
1124
1125 SetEntity(entity)
1126 SetEntityPool(entity.ID, pool)
1127
1128 retrievedPool, ok := GetPoolByID(pool.ID)
1129 c.Require().True(ok)
1130 c.Require().Equal(pool.ID, retrievedPool.ID)
1131 c.Require().Equal(pool.Enabled, retrievedPool.Enabled)
1132 c.Require().Len(retrievedPool.Tags, 1)
1133 c.Require().Equal("test-tag", retrievedPool.Tags[0].Name)
1134
1135 nonExistentPool, ok := GetPoolByID("non-existent-pool")
1136 c.Require().False(ok)
1137 c.Require().Equal(params.Pool{}, nonExistentPool)
1138}
1139
1140func (c *CacheTestSuite) TestGetScaleSetByID() {
1141 entity := params.ForgeEntity{

Callers

nothing calls this directly

Calls 4

SetEntityFunction · 0.85
SetEntityPoolFunction · 0.85
GetPoolByIDFunction · 0.85
LenMethod · 0.65

Tested by

no test coverage detected