Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add external service #3055

Merged
merged 10 commits into from Jul 23, 2018
Merged

feat: add external service #3055

merged 10 commits into from Jul 23, 2018

Conversation

sguiheux
Copy link
Collaborator

  1. Description
  2. Related issues
  3. About tests
  4. Mentions

@ovh/cds

@sguiheux sguiheux requested review from fsamin and bnjjj July 23, 2018 08:37
engine/main.go Outdated
@@ -141,6 +141,7 @@ Comming soon...`,
conf.API.Auth.SharedInfraToken = sdk.RandomString(128)
conf.API.Secrets.Key = sdk.RandomString(32)
conf.API.Providers = append(conf.API.Providers, api.ProviderConfiguration{"sample-provider", sdk.RandomString(32)})
conf.API.Services = append(conf.API.Services, api.ServiceConfiguration{"sample-service", "https://ovh.github.io", 443, "/cds", 443, "doc"})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github.com/ovh/cds/engine/api.ServiceConfiguration composite literal uses unkeyed fields

if err := services.InitExternal(a.mustDB, a.Cache, externalServices); err != nil {
return fmt.Errorf("unable to init external service: %v", err)
}
go services.Pings(ctx, a.mustDB, externalServices)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sdk.GoRoutine

mockService := &sdk.Service{Name: "Test_postImportAsCodeHandler", Type: services.TypeRepositories}
repositoryService.Delete(mockService)
test.NoError(t, repositoryService.Insert(mockService))
services.Delete(api.mustDB(), mockService)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of services.Delete is not checked

mockService := &sdk.Service{Name: "Test_getImportAsCodeHandler", Type: services.TypeRepositories}
repositoryService.Delete(mockService)
test.NoError(t, repositoryService.Insert(mockService))
services.Delete(db, mockService)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of services.Delete is not checked

mockService := &sdk.Service{Name: "Test_postPerformImportAsCodeHandler_Repo", Type: services.TypeRepositories}
repositoryService.Delete(mockService)
test.NoError(t, repositoryService.Insert(mockService))
services.Delete(db, mockService)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of services.Delete is not checked

return sdk.WrapError(err, "postServiceRegisterHandler")
}
defer tx.Rollback()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of tx.Rollback is not checked

log.Error("serviceAPIHeartbeat> error on repo.Begin:%v", err)
return
}
defer tx.Rollback()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of tx.Rollback is not checked


mockService = &sdk.Service{Name: "Test_postPerformImportAsCodeHandler_VCS", Type: services.TypeHooks}
repositoryService.Delete(mockService)
test.NoError(t, repositoryService.Insert(mockService))
services.Delete(db, mockService)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of services.Delete is not checked

mockService := &sdk.Service{Name: "service_test", Type: "hooks"}
repositoryService.Delete(mockService)
test.NoError(t, repositoryService.Insert(mockService))
services.Delete(db, mockService)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error return value of services.Delete is not checked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants