@@ -37,12 +37,18 @@ func Test_uuidFromSecret(t *testing.T) {
3737 assert .EqualValues (t , uuid , "41414141-4141-4141-4141-414141414141" )
3838}
3939
40- func Test_ping (t * testing.T ) {
41- cfg := & config. Config {}
40+ func getForgejoFromEnv (t * testing.T ) string {
41+ t . Helper ()
4242 address := os .Getenv ("FORGEJO_URL" )
4343 if address == "" {
44- address = "https://code.forgejo.org"
44+ t . Skip ( "skipping because FORGEJO_URL is not set" )
4545 }
46+ return address
47+ }
48+
49+ func Test_ping (t * testing.T ) {
50+ cfg := & config.Config {}
51+ address := getForgejoFromEnv (t )
4652 reg := & config.Registration {
4753 Address : address ,
4854 UUID : "create-runner-file_test.go" ,
@@ -51,6 +57,8 @@ func Test_ping(t *testing.T) {
5157}
5258
5359func Test_runCreateRunnerFile (t * testing.T ) {
60+ instance := getForgejoFromEnv (t )
61+
5462 //
5563 // Set the .runner file to be in a temporary directory
5664 //
@@ -63,10 +71,6 @@ func Test_runCreateRunnerFile(t *testing.T) {
6371 assert .NoError (t , err )
6472 assert .NoError (t , os .WriteFile (configFile , yamlData , 0o666 ))
6573
66- instance , has := os .LookupEnv ("FORGEJO_URL" )
67- if ! has {
68- instance = "https://code.forgejo.org"
69- }
7074 secret , has := os .LookupEnv ("FORGEJO_RUNNER_SECRET" )
7175 assert .True (t , has )
7276 name := "testrunner"
0 commit comments