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

Method TestGetEntityPools

cache/cache_test.go:603–645  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

601}
602
603func (c *CacheTestSuite) TestGetEntityPools() {
604 entity := params.ForgeEntity{
605 ID: "test-entity",
606 EntityType: params.ForgeEntityTypeOrganization,
607 Name: "test",
608 Owner: "test",
609 }
610 pool1 := params.Pool{
611 ID: "pool-1",
612 OrgID: "test-entity",
613 Tags: []params.Tag{
614 {
615 Name: "tag1",
616 },
617 {
618 Name: "tag2",
619 },
620 },
621 }
622 pool2 := params.Pool{
623 ID: "pool-2",
624 OrgID: "test-entity",
625 Tags: []params.Tag{
626 {
627 Name: "tag1",
628 },
629 {
630 Name: "tag3",
631 },
632 },
633 }
634
635 SetEntity(entity)
636 SetEntityPool(entity.ID, pool1)
637 SetEntityPool(entity.ID, pool2)
638 cachedEntity, ok := GetEntity(entity.ID)
639 c.Require().True(ok)
640 c.Require().Equal(entity.ID, cachedEntity.ID)
641 pools := GetEntityPools(entity.ID)
642 c.Require().Len(pools, 2)
643 c.Require().Contains(pools, pool1)
644 c.Require().Contains(pools, pool2)
645}
646
647func (c *CacheTestSuite) TestGetEntityScaleSet() {
648 entity := params.ForgeEntity{

Callers

nothing calls this directly

Calls 5

SetEntityFunction · 0.85
SetEntityPoolFunction · 0.85
GetEntityFunction · 0.85
GetEntityPoolsFunction · 0.85
LenMethod · 0.65

Tested by

no test coverage detected