Test Framework #80

Closed
opened 2017-11-25 15:42:20 +00:00 by lunny · 6 comments
Owner

Author: @klauern

How can someone set up a test environment for adding tests to this SDK? I'm at a loss as I don't quite understand how the main gitea project is doing tests. I'd think it's possible to do something with Docker, but I'm not terribly confident that you can spin up a gitea server and then run go test with it.

Would it be possible to set up something equivalent to a golden file/db so you could use it as a baseline for tests?

Author: @klauern <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> How can someone set up a test environment for adding tests to this SDK? I'm at a loss as I don't quite understand how the main gitea project is doing tests. I'd think it's possible to do something with Docker, but I'm not terribly confident that you can spin up a gitea server and then run `go test` with it. Would it be possible to set up something equivalent to a [golden file/db](https://medium.com/@povilasve/go-advanced-tips-tricks-a872503ac859) so you could use it as a baseline for tests?
Author
Owner

Author: @klauern

Thinking out loud here, but I had good experience testing and contributing to a Jenkins API using a Travis-CI build file: https://github.com/bndr/gojenkins/blob/master/.travis.yml

Author: @klauern Thinking out loud here, but I had good experience testing and contributing to a Jenkins API using a Travis-CI build file: https://github.com/bndr/gojenkins/blob/master/.travis.yml
Author
Owner

Author: @lafriks

We are using drone for testing

Author: @lafriks We are using drone for testing
Author
Owner
Author: @lafriks https://github.com/go-gitea/go-sdk/blob/master/.drone.yml
Author
Owner

Author: @klauern

I think that's a great start, but I probably should have pointed to what I liked about the Travis setup:

  - docker run -d --name=jenkins -p 8080:8080 --env JAVA_OPTS=-Djenkins.install.runSetupWizard=false gojenkins

The Jenkins instance is running, so the tests work against it with a known login, etc.. I don't see any of that in the drone config. Do the sections in the pipeline all run within the same context? Can a gitea server be run in the background so the other steps in the pipeline can run a test against a running instance?

Also, does the Gitea SDK client need a token generated, or can it use a default user created with gitea admin create-user? What's the hands-free way to do that?

Author: @klauern I think that's a great start, but I probably should have pointed to what I liked about the Travis setup: ``` - docker run -d --name=jenkins -p 8080:8080 --env JAVA_OPTS=-Djenkins.install.runSetupWizard=false gojenkins ``` The Jenkins instance is running, so the tests work against it with a known login, etc.. I don't see any of that in the drone config. Do the sections in the pipeline all run within the same context? Can a gitea server be run in the background so the other steps in the pipeline can run a test against a running instance? Also, does the Gitea SDK client need a token generated, or can it use a default user created with `gitea admin create-user`? What's the hands-free way to do that?
Author
Owner

Author: @bkcsoft

Spinning up gitea/gitea:master as a service for running tests in easy enough. Someone just have to make tests ;)

Author: @bkcsoft Spinning up `gitea/gitea:master` as a service for running tests in easy enough. Someone just have to make tests ;)
Author
Owner

Author: @jonasfranz

I'm currently using gitea as a service (GaaS 😂 ) for testing the migration tool. I've created a seperate docker image containing a gitea instance which is already set up.

gitea-service: https://git.jonasfranz.software/JonasFranzDEV/gitea-service

PR with gitea-service tests: https://git.jonasfranz.software/JonasFranzDEV/gitea-github-migrator/pulls/5

Author: @jonasfranz I'm currently using gitea as a service (GaaS :joy: ) for testing the migration tool. I've created a seperate docker image containing a gitea instance which is already set up. gitea-service: https://git.jonasfranz.software/JonasFranzDEV/gitea-service PR with gitea-service tests: https://git.jonasfranz.software/JonasFranzDEV/gitea-github-migrator/pulls/5
lunny added the
kind/testing
label 2019-11-05 13:21:43 +00:00
6543 added this to the v0.11.0 milestone 2020-01-12 13:09:37 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/go-sdk#80
No description provided.