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

Method TestReplaceEntityPools

cache/cache_test.go:346–384  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

344}
345
346func (c *CacheTestSuite) TestReplaceEntityPools() {
347 entity := params.ForgeEntity{
348 ID: "test-entity",
349 EntityType: params.ForgeEntityTypeOrganization,
350 Name: "test",
351 Owner: "test",
352 Credentials: params.ForgeCredentials{
353 ID: 1,
354 ForgeType: params.GithubEndpointType,
355 },
356 }
357 pool1 := params.Pool{
358 ID: "pool-1",
359 OrgID: "test-entity",
360 }
361 pool2 := params.Pool{
362 ID: "pool-2",
363 OrgID: "test-entity",
364 }
365
366 credentials := params.ForgeCredentials{
367 ID: 1,
368 Name: "test",
369 ForgeType: params.GithubEndpointType,
370 }
371 SetGithubCredentials(credentials)
372
373 SetEntity(entity)
374 ReplaceEntityPools(entity.ID, []params.Pool{pool1, pool2})
375 cachedEntity, ok := GetEntity(entity.ID)
376 c.Require().True(ok)
377 c.Require().Equal(entity.ID, cachedEntity.ID)
378 c.Require().Equal("test", cachedEntity.Credentials.Name)
379
380 pools := GetEntityPools(entity.ID)
381 c.Require().Len(pools, 2)
382 c.Require().Contains(pools, pool1)
383 c.Require().Contains(pools, pool2)
384}
385
386func (c *CacheTestSuite) TestReplaceEntityScaleSets() {
387 entity := params.ForgeEntity{

Callers

nothing calls this directly

Calls 6

SetGithubCredentialsFunction · 0.85
SetEntityFunction · 0.85
ReplaceEntityPoolsFunction · 0.85
GetEntityFunction · 0.85
GetEntityPoolsFunction · 0.85
LenMethod · 0.65

Tested by

no test coverage detected