Skip to content

TestAPIGitTags Fails To Read Correct User On Drone Docker Runner #14247

Closed
@kdumontnu

Description

@kdumontnu
  • Gitea version (or commit ref):
  • Git version (SHA): cfc3916
  • Operating system: docker image: golang:1.15
platform:
  os: linux
  arch: amd64

services:
  - name: pgsql
    pull: default
    image: postgres:12
    environment:
      POSTGRES_DB: test
      POSTGRES_PASSWORD: postgres

steps:
  - name: test-pgsql
    image: golang:1.15
    commands:
      - "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
      - apt-get install -y git-lfs
      - timeout -s ABRT 40m make test-pgsql-migration test-pgsql
    environment:
      GOPROXY: off
      TAGS: bindata
      TEST_LDAP: 1
      USE_REPO_TEST_DIR: 1
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:
=== TestAPIGitTags (integrations/api_repo_git_tags_test.go:20)
--
166 | --- FAIL: TestAPIGitTags (0.55s)
167 | testlogger.go:78: 2021/01/04 16:51:57 ...outers/routes/chi.go:95:1() [I] Completed GET /api/v1/repos/user2/repo1/git/refs/heads/unknown?token=9b325eff34509b0c785ab027003729a350cdb815 0  in 31.289586ms
168 | testlogger.go:78: 2021/01/04 16:51:57 ...outers/routes/chi.go:88:1() [I] Started GET /user/settings/applications for
169 | testlogger.go:78: 2021/01/04 16:51:57 ...outers/routes/chi.go:95:1() [I] Completed GET /user/settings/applications 0  in 7.005154ms
170 | testlogger.go:78: 2021/01/04 16:51:57 ...outers/routes/chi.go:88:1() [I] Started POST /user/settings/applications for
171 | testlogger.go:78: 2021/01/04 16:51:57 ...outers/routes/chi.go:95:1() [I] Completed POST /user/settings/applications 0  in 22.903611ms
172 | testlogger.go:78: 2021/01/04 16:51:57 ...outers/routes/chi.go:88:1() [I] Started GET /user/settings/applications for
173 | testlogger.go:78: 2021/01/04 16:51:57 ...outers/routes/chi.go:95:1() [I] Completed GET /user/settings/applications 0  in 6.910047ms
174 | testlogger.go:78: 2021/01/04 16:51:57 ...outers/routes/chi.go:88:1() [I] Started GET /api/v1/repos/user2/repo1/git/tags/692695075cdd379eebde360da52777fab043ee18?token=4ba9396fdf49c98b36c9807148b9fa4edfe54954 for
175 | api_repo_git_tags_test.go:54:
176 | Error Trace:	api_repo_git_tags_test.go:54
177 | Error:      	Not equal:
178 | expected: "user2"
179 | actual  : "Kyle D"
180 |  
181 | Diff:
182 | --- Expected
183 | +++ Actual
184 | @@ -1 +1 @@
185 | -user2
186 | +Kyle D
187 | Test:       	TestAPIGitTags
188 | testlogger.go:78: 2021/01/04 16:51:57 ...outers/routes/chi.go:95:1() [I] Completed GET /api/v1/repos/user2/repo1/git/tags/692695075cdd379eebde360da52777fab043ee18?token=4ba9396fdf49c98b36c9807148b9fa4edfe54954 0  in 51.374277ms
189 | api_repo_git_tags_test.go:55:
190 | Error Trace:	api_repo_git_tags_test.go:55
191 | Error:      	Not equal:
192 | expected: "[email protected]"
193 | actual  : "[email protected]"
194 |  
195 | Diff:
196 | --- Expected
197 | +++ Actual
198 | @@ -1 +1 @@
199 | [email protected]
200 | [email protected]
201 | Test:       	TestAPIGitTags
202 | testlogger.go:78: 2021/01/04 16:51:57 ...outers/routes/chi.go:88:1() [I]

Description

CI runner is failing on TestAPIGitTags using the settings above. It appears that the git user and git email are not read correctly from the annotated tag. It resolves to my user credentials instead of the mock credentials from the test. It actually appears that the API is working fine, because gitRepo.GetTag(aTagName) returns the same info that the API request is getting. In fact, I've updated the test to:

	assert.Equal(t, aTag.Tagger.Name, tag.Tagger.Name)
	assert.Equal(t, aTag.Tagger.Email, tag.Tagger.Email)

However, there still appears to be an issue with either writing via CreateAnnotatedTag or reading via GetTag because, as I understand it, neither case should use my system credentials.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions