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

Method TestReplaceEntityScaleSets

cache/cache_test.go:386–412  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

384}
385
386func (c *CacheTestSuite) TestReplaceEntityScaleSets() {
387 entity := params.ForgeEntity{
388 ID: "test-entity",
389 EntityType: params.ForgeEntityTypeOrganization,
390 Name: "test",
391 Owner: "test",
392 }
393 scaleSet1 := params.ScaleSet{
394 ID: 1,
395 OrgID: "test-entity",
396 }
397 scaleSet2 := params.ScaleSet{
398 ID: 2,
399 OrgID: "test-entity",
400 }
401
402 SetEntity(entity)
403 ReplaceEntityScaleSets(entity.ID, []params.ScaleSet{scaleSet1, scaleSet2})
404 cachedEntity, ok := GetEntity(entity.ID)
405 c.Require().True(ok)
406 c.Require().Equal(entity.ID, cachedEntity.ID)
407
408 scaleSets := GetEntityScaleSets(entity.ID)
409 c.Require().Len(scaleSets, 2)
410 c.Require().Contains(scaleSets, scaleSet1)
411 c.Require().Contains(scaleSets, scaleSet2)
412}
413
414func (c *CacheTestSuite) TestDeleteEntity() {
415 entity := params.ForgeEntity{

Callers

nothing calls this directly

Calls 5

SetEntityFunction · 0.85
ReplaceEntityScaleSetsFunction · 0.85
GetEntityFunction · 0.85
GetEntityScaleSetsFunction · 0.85
LenMethod · 0.65

Tested by

no test coverage detected