Skip to content

Conversation

@jxs1211
Copy link

@jxs1211 jxs1211 commented Jul 27, 2022

Signed-off-by: xian-jie.shen 327411586@qq.com

Pre-Checklist

Note: please complete ALL items in the following checklist.

  • I have read through the CONTRIBUTING.md documentation.
  • My code has the necessary comments and documentation (if needed).
  • I have added relevant tests

Description

add ut for repo

Related Issues

see #833 for the details

New Behavior (screenshots if needed)

[going@dev github]$ go tool cover -func=coverage.out
github.com/devstream-io/devstream/pkg/util/github/repo.go:12:                   CreateRepo                              100.0%
github.com/devstream-io/devstream/pkg/util/github/repo.go:28:                   DeleteRepo                              100.0%
github.com/devstream-io/devstream/pkg/util/github/repo.go:51:                   GetRepoDescription                      81.8%
github.com/devstream-io/devstream/pkg/util/github/repo.go:79:                   PushLocalPathToBranch                   26.7%
github.com/devstream-io/devstream/pkg/util/github/repo.go:105:                  InitRepo                                100.0%
[going@dev github]$ 

@jxs1211 jxs1211 requested a review from a team as a code owner July 27, 2022 12:03
@iyear
Copy link
Member

iyear commented Jul 28, 2022

@jxs1211 Please check the ci error and try to resolve the conflict. Thanks!

@jxs1211 jxs1211 force-pushed the feat-pkg-util-github-repo branch 2 times, most recently from d255832 to 91d7fd6 Compare July 28, 2022 04:22
@jxs1211
Copy link
Author

jxs1211 commented Jul 28, 2022

@jxs1211 Please check the ci error and try to resolve the conflict. Thanks!

@iyear the conflicts have been resolved. But the ci error haven't yet, I find the output of the error:

Running Suite: GitHub Suite - /home/runner/work/devstream/devstream/pkg/util/github
===================================================================================
Random Seed: 1658982331

Will run 38 of 38 specs
••••••<nil>
••••••••••••••••••••2022-07-28 04:25:31 ℹ [INFO]  Prepare to create an organization repository: or/r
•2022-07-28 04:25:31 ℹ [INFO]  Prepare to create an organization repository: or/r
•2022-07-28 04:25:31 ℹ [INFO]  r%!(EXTRA string=mb)
Error: -28 04:25:31 !! [ERROR]  Failed to create repo: POST http://127.0.0.1:37449/api-v3/user/repos: 404  [].
•2022-07-28 04:25:31 ℹ [INFO]  r%!(EXTRA string=mb)
2022-07-28 04:25:31 ℹ [INFO]  Prepare to create an organization repository: or/r
2022-07-28 04:25:31 ℹ [INFO]  The repo r has been created.
•2022-07-28 04:25:31 ℹ [INFO]  r%!(EXTRA string=mb)
2022-07-28 04:25:31 ℹ [INFO]  Prepare to create an organization repository: or/r
2022-07-28 04:25:31 ℹ [INFO]  The repo r has been created.
•••2022-07-28 04:25:31 ℹ [INFO]  GitHub repo  was not found. Nothing to do here.
•2022-07-28 04:25:31 ✔ [SUCCESS]  GitHub repo r removed.
•••panic: test timed out after 10m0s

goroutine 170 [running]:
testing.(*M).startAlarm.func1()
	/opt/hostedtoolcache/go/1.18.4/x64/src/testing/testing.go:2029 +0x8e
created by time.goFunc
	/opt/hostedtoolcache/go/1.18.4/x64/src/time/sleep.go:176 +0x32

I noticed that the test time out was set to 10m which is supposed not to raise this timeout error, I've verified the test will pass successfully by setting the timeout to 10m\10s in my local environment. Only one condition can reproduce the error by setting the time out to 1s below:

[going@dev github]$ go test -run=TestPlanmanager -cover  -coverprofile=./coverage.out -timeout=1s -v
=== RUN   TestPlanmanager
Running Suite: GitHub Suite - /d/work/src/go/open_source/devstream/pkg/util/github
==================================================================================
Random Seed: 1658985340

Will run 38 of 38 specs
•••••2022-07-28 13:15:40 ℹ [INFO]  Prepare to create an organization repository: or/r
•2022-07-28 13:15:40 ℹ [INFO]  Prepare to create an organization repository: or/r
•2022-07-28 13:15:40 ℹ [INFO]  r%!(EXTRA string=mb)
2022-07-28 13:15:40 !! [ERROR]  Failed to create repo: POST http://127.0.0.1:37331/api-v3/user/repos: 404  [].
•2022-07-28 13:15:40 ℹ [INFO]  r%!(EXTRA string=mb)
2022-07-28 13:15:40 ℹ [INFO]  Prepare to create an organization repository: or/r
2022-07-28 13:15:40 ℹ [INFO]  The repo r has been created.
•2022-07-28 13:15:40 ℹ [INFO]  r%!(EXTRA string=mb)
2022-07-28 13:15:40 ℹ [INFO]  Prepare to create an organization repository: or/r
2022-07-28 13:15:40 ℹ [INFO]  The repo r has been created.
•••2022-07-28 13:15:40 ℹ [INFO]  GitHub repo  was not found. Nothing to do here.
•2022-07-28 13:15:40 ✔ [SUCCESS]  GitHub repo r removed.
••••••••••••••••••••••<nil>
•coverage: 55.9% of statements
panic: test timed out after 1s

goroutine 173 [running]:
testing.(*M).startAlarm.func1()
        /home/going/go/go1.18.3/src/testing/testing.go:2029 +0x8e

so I'm a little bit confused why this error could happened, or there is something I missed?

@jxs1211 jxs1211 force-pushed the feat-pkg-util-github-repo branch from 91d7fd6 to 7905694 Compare July 28, 2022 06:54
Signed-off-by: xian-jie.shen <327411586@qq.com>
@jxs1211 jxs1211 force-pushed the feat-pkg-util-github-repo branch from 7905694 to 090365e Compare July 30, 2022 09:47
@jxs1211
Copy link
Author

jxs1211 commented Jul 30, 2022

@jxs1211 Please check the ci error and try to resolve the conflict. Thanks!

@iyear I've rewritten the code and fixed the error.

Copy link
Member

@iyear iyear left a comment

Choose a reason for hiding this comment

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

Awesome!

@iyear iyear merged commit c37713b into devstream-io:main Aug 1, 2022
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.

4 participants