()
| 208 | } |
| 209 | |
| 210 | func (s *PoolsTestSuite) TestEntityPoolOperations() { |
| 211 | ep := garmTesting.CreateDefaultGithubEndpoint(s.ctx, s.Store, s.T()) |
| 212 | creds := garmTesting.CreateTestGithubCredentials(s.ctx, "test-creds", s.Store, s.T(), ep) |
| 213 | s.T().Cleanup(func() { s.Store.DeleteGithubCredentials(s.ctx, creds.ID) }) |
| 214 | repo, err := s.Store.CreateRepository(s.ctx, "test-owner", "test-repo", creds, "test-secret", params.PoolBalancerTypeRoundRobin, false) |
| 215 | s.Require().NoError(err) |
| 216 | s.Require().NotEmpty(repo.ID) |
| 217 | s.T().Cleanup(func() { s.Store.DeleteRepository(s.ctx, repo.ID) }) |
| 218 | |
| 219 | entity, err := repo.GetEntity() |
| 220 | s.Require().NoError(err) |
| 221 | |
| 222 | createPoolParams := params.CreatePoolParams{ |
| 223 | ProviderName: "test-provider", |
| 224 | MaxRunners: 5, |
| 225 | Image: "test-image", |
| 226 | Flavor: "test-flavor", |
| 227 | OSType: commonParams.Linux, |
| 228 | OSArch: commonParams.Amd64, |
| 229 | Tags: []string{"test-tag"}, |
| 230 | } |
| 231 | |
| 232 | pool, err := s.Store.CreateEntityPool(s.ctx, entity, createPoolParams) |
| 233 | s.Require().NoError(err) |
| 234 | s.Require().NotEmpty(pool.ID) |
| 235 | s.T().Cleanup(func() { s.Store.DeleteEntityPool(s.ctx, entity, pool.ID) }) |
| 236 | |
| 237 | entityPool, err := s.Store.GetEntityPool(s.ctx, entity, pool.ID) |
| 238 | s.Require().NoError(err) |
| 239 | s.Require().Equal(pool.ID, entityPool.ID) |
| 240 | s.Require().Equal(pool.ProviderName, entityPool.ProviderName) |
| 241 | |
| 242 | updatePoolParams := params.UpdatePoolParams{ |
| 243 | Enabled: garmTesting.Ptr(true), |
| 244 | Flavor: "new-flavor", |
| 245 | Image: "new-image", |
| 246 | RunnerPrefix: params.RunnerPrefix{ |
| 247 | Prefix: "new-prefix", |
| 248 | }, |
| 249 | MaxRunners: garmTesting.Ptr(uint(100)), |
| 250 | MinIdleRunners: garmTesting.Ptr(uint(50)), |
| 251 | OSType: commonParams.Windows, |
| 252 | OSArch: commonParams.Amd64, |
| 253 | Tags: []string{"new-tag"}, |
| 254 | RunnerBootstrapTimeout: garmTesting.Ptr(uint(10)), |
| 255 | ExtraSpecs: json.RawMessage(`{"extra": "specs"}`), |
| 256 | GitHubRunnerGroup: garmTesting.Ptr("new-group"), |
| 257 | Priority: garmTesting.Ptr(uint(1)), |
| 258 | } |
| 259 | pool, err = s.Store.UpdateEntityPool(s.ctx, entity, pool.ID, updatePoolParams) |
| 260 | s.Require().NoError(err) |
| 261 | s.Require().Equal(*updatePoolParams.Enabled, pool.Enabled) |
| 262 | s.Require().Equal(updatePoolParams.Flavor, pool.Flavor) |
| 263 | s.Require().Equal(updatePoolParams.Image, pool.Image) |
| 264 | s.Require().Equal(updatePoolParams.Prefix, pool.Prefix) |
| 265 | s.Require().Equal(*updatePoolParams.MaxRunners, pool.MaxRunners) |
| 266 | s.Require().Equal(*updatePoolParams.MinIdleRunners, pool.MinIdleRunners) |
| 267 | s.Require().Equal(updatePoolParams.OSType, pool.OSType) |
nothing calls this directly
no test coverage detected