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

Method TestSetEntityPool

cache/cache_test.go:432–464  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

430}
431
432func (c *CacheTestSuite) TestSetEntityPool() {
433 entity := params.ForgeEntity{
434 ID: "test-entity",
435 EntityType: params.ForgeEntityTypeOrganization,
436 Name: "test",
437 Owner: "test",
438 }
439 pool := params.Pool{
440 OrgID: "test-entity",
441 ID: "pool-1",
442 }
443
444 SetEntity(entity)
445
446 SetEntityPool(entity.ID, pool)
447 cachedEntity, ok := GetEntity(entity.ID)
448 c.Require().True(ok)
449 c.Require().Equal(entity.ID, cachedEntity.ID)
450 pools := GetEntityPools(entity.ID)
451 c.Require().Len(pools, 1)
452 c.Require().Contains(pools, pool)
453 c.Require().False(pools[0].Enabled)
454
455 pool.Enabled = true
456 SetEntityPool(entity.ID, pool)
457 cachedEntity, ok = GetEntity(entity.ID)
458 c.Require().True(ok)
459 c.Require().Equal(entity.ID, cachedEntity.ID)
460 pools = GetEntityPools(entity.ID)
461 c.Require().Len(pools, 1)
462 c.Require().Contains(pools, pool)
463 c.Require().True(pools[0].Enabled)
464}
465
466func (c *CacheTestSuite) TestSetEntityScaleSet() {
467 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