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

Method TestGetAllPools

cache/cache_test.go:948–993  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

946}
947
948func (c *CacheTestSuite) TestGetAllPools() {
949 entity := params.ForgeEntity{
950 ID: "test-entity",
951 EntityType: params.ForgeEntityTypeOrganization,
952 Name: "test",
953 Owner: "test",
954 }
955 pool1 := params.Pool{
956 ID: "pool-1",
957 OrgID: "test-entity",
958 CreatedAt: time.Now(),
959 Tags: []params.Tag{
960 {
961 Name: "tag1",
962 },
963 {
964 Name: "tag2",
965 },
966 },
967 }
968
969 pool2 := params.Pool{
970 ID: "pool-2",
971 OrgID: "test-entity",
972 CreatedAt: time.Now().Add(1 * time.Second),
973 Tags: []params.Tag{
974 {
975 Name: "tag1",
976 },
977 {
978 Name: "tag3",
979 },
980 },
981 }
982
983 SetEntity(entity)
984 SetEntityPool(entity.ID, pool1)
985 SetEntityPool(entity.ID, pool2)
986 cachedEntity, ok := GetEntity(entity.ID)
987 c.Require().True(ok)
988 c.Require().Equal(entity.ID, cachedEntity.ID)
989 pools := GetAllPools()
990 c.Require().Len(pools, 2)
991 c.Require().Equal(pools[0].ID, pool1.ID)
992 c.Require().Equal(pools[1].ID, pool2.ID)
993}
994
995func (c *CacheTestSuite) TestGetAllScaleSets() {
996 entity := params.ForgeEntity{

Callers

nothing calls this directly

Calls 6

SetEntityFunction · 0.85
SetEntityPoolFunction · 0.85
GetEntityFunction · 0.85
GetAllPoolsFunction · 0.85
AddMethod · 0.80
LenMethod · 0.65

Tested by

no test coverage detected