-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Expose repository_object_format via Project API #1125
base: main
Are you sure you want to change the base?
Conversation
GitLab 16.9 introduced an option to create repositories with SHA256 instead of SHA1. This commit exposes object format used by particular repository via Project API. See https://gitlab.com/gitlab-org/gitlab/-/issues/419887 Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
8c07922
to
bb9445c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please also update the json file /gitlab4j-api/src/test/resources/org/gitlab4j/api/project.json
that corresponds to this model and that is used in the TestGitLabApiBeans
test.
@@ -224,6 +224,7 @@ public void testCreate() throws GitLabApiException { | |||
.withMergeRequestsEnabled(true) | |||
.withWikiEnabled(true) | |||
.withSnippetsEnabled(true) | |||
.withRepositoryObjectFormat("sha1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I am not mistaken this test is using the GitLab installation started in Docker while the integration tests are running.
This version is very old and this test will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... Is there any reference test that I could use for this new field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pipeline in GitHub action is failing as expected:
Error: Failures:
Error: TestProjectApi.testCreate:239 expected: <sha1> but was: <null>
[INFO]
Error: Tests run: 308, Failures: 1, Errors: 0, Skipped: 14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests are using Mockito but this feels also wrong.
I started to experiment to use testcontainers to run a newer GitLab version (there is some work in a PR).
But I am wondering if we should not just Mock the GitLab server in order to run the unit-test quickly.
I would say that for now TestProjectApi.testCreate()
remains unchanged and we merge your change.
@jmini is it ok that repositoryObjectFormat is a string? Or it would be better if it was a enum, like project vsibility? |
I am always not really sure about the String vs enum… In the docs they just mention |
Yes,
Ok. |
Converting to draft until I fix test issues. |
GitLab 16.9 introduced an option to create repositories with SHA256 instead of SHA1.
This commit exposes object format used by particular repository via Project API.
See https://gitlab.com/gitlab-org/gitlab/-/issues/419887