Closed pnispero closed 2 weeks ago
Still need to write tests for this issue creation endpoint
Finished writing the logic for the issue creation, I created a test to go along with it, but I can't seem to get it working.
addIssue()
in repository/GithubServerRepostory.java
is where it bugs out. GHRepository repo = ghInstancer.ghOrganization(coreBuildProperties.getGithubOrgName()).getRepository(component.getName());
I get a null repo.organization-a
, not ad-build-test
)enableEvent()
also uses that GHRepository class)? See screenshots for detail.
Screenshots:
is organization
a new field?
anyway good to know, i add a default parameter to have a default organization value. so to be conservative with the past i suggest this fix:
var orgName = component.organization()==null?coreBuildProperties.getGithubOrgName():component.organization();
GHRepository repo = ghInstancer.ghOrganization(orgName).getRepository(component.getName());
so in case the organization is null it will get the default one configurad with thi paramter:
edu:
stanford:
slac:
core-build-system:
github-org-name: ${CBS_GH_ORG_NAME:ad-build-test}
remember each organization should authorize the github application used by the backend to read the repository and create pull request
Update
organization-a
, but that did not solve the issue. I am still getting a null GHOrganization
and in turn a null GHRepository
. GHOrganization
, but unfortunately it seems like none of the functions are being called during the tests, and there is a test/.../repository/GithubRepositoryTest.java
that has a test to call those existing functions, but its commented out, so seems like any GHOrganization
functionality hasn't been actually tested if it works.Update
For now, I will omit the test since can't get it to work right. But the endpoint itself works, I've tested it with a dev-release on a real repository test-ioc
on ad-build-test
organization.
Curl Request
Actual issue created on the test-ioc
repository
Have you configured, before running the test, the GitHub app env variables? If not, it won’t work. Deploying and testing should work
Overall Project | 66.76% -1.68% |
:green_apple: |
---|---|---|
Files changed | 0% | :x: |
File | Coverage | |
---|---|---|
ComponentMapper.java | 100% | :green_apple: |
ComponentService.java | 63.17% -6.71% |
:x: |
ComponentController.java | 53.13% -10.94% |
:x: |
GithubServerRepository.java | 8.01% -14.09% |
:x: |
Overall Project | 65.83% -4.07% |
:green_apple: |
---|---|---|
Files changed | 0% | :x: |
File | Coverage | |
---|---|---|
ComponentMapper.java | 100% | :green_apple: |
ComponentService.java | 63.17% -6.71% |
:x: |
ComponentController.java | 53.13% -10.94% |
:x: |
GithubServerRepository.java | 6.36% -47.15% |
:x: |
-1.51%
-6.59%
-10.94%
-11.4%