()
| 344 | } |
| 345 | |
| 346 | func (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 | |
| 386 | func (c *CacheTestSuite) TestReplaceEntityScaleSets() { |
| 387 | entity := params.ForgeEntity{ |
nothing calls this directly
no test coverage detected