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

Method TestSetEntityScaleSet

cache/cache_test.go:466–495  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

464}
465
466func (c *CacheTestSuite) TestSetEntityScaleSet() {
467 entity := params.ForgeEntity{
468 ID: "test-entity",
469 EntityType: params.ForgeEntityTypeOrganization,
470 Name: "test",
471 Owner: "test",
472 }
473 scaleSet := params.ScaleSet{
474 OrgID: "test-entity",
475 ID: 1,
476 }
477
478 SetEntity(entity)
479 SetEntityScaleSet(entity.ID, scaleSet)
480
481 cachedEntity, ok := GetEntity(entity.ID)
482 c.Require().True(ok)
483 c.Require().Equal(entity.ID, cachedEntity.ID)
484 scaleSets := GetEntityScaleSets(entity.ID)
485 c.Require().Len(scaleSets, 1)
486 c.Require().Contains(scaleSets, scaleSet)
487 c.Require().False(scaleSets[0].Enabled)
488
489 scaleSet.Enabled = true
490 SetEntityScaleSet(entity.ID, scaleSet)
491 scaleSets = GetEntityScaleSets(entity.ID)
492 c.Require().Len(scaleSets, 1)
493 c.Require().Contains(scaleSets, scaleSet)
494 c.Require().True(scaleSets[0].Enabled)
495}
496
497func (c *CacheTestSuite) TestDeleteEntityPool() {
498 entity := params.ForgeEntity{

Callers

nothing calls this directly

Calls 5

SetEntityFunction · 0.85
SetEntityScaleSetFunction · 0.85
GetEntityFunction · 0.85
GetEntityScaleSetsFunction · 0.85
LenMethod · 0.65

Tested by

no test coverage detected