-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjob_params_test.go
54 lines (39 loc) · 1.41 KB
/
job_params_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package e2e
import (
lib "github.com/bazooka-ci/bazooka/commons"
"github.com/stretchr/testify/require"
"testing"
"time"
)
func TestJobParameters(t *testing.T) {
bzk := NewBazooka(t)
defer bzk.Teardown()
repo := bzk.NewRepository()
repo.ImportDir("data/params-project")
repo.GitAddAll()
repo.GitCommit("Point of inception")
proj, err := bzk.Api.Project.Create("param-proj", "git", repo.CloneURL())
require.NoError(t, err, "error while creating a project")
t.Logf("Created project: %v", proj.ID)
job, err := bzk.Api.Project.StartJob(proj.ID, "master", []string{"PARAM=42"})
require.NoError(t, err, "job creation failed")
t.Logf("Started job: %v", job)
jobStatus := bzk.WaitForJob(job.ID, 60*time.Second)
require.Equal(t, lib.JOB_SUCCESS, jobStatus)
}
func TestJobParametersOverrideEnv(t *testing.T) {
bzk := NewBazooka(t)
defer bzk.Teardown()
repo := bzk.NewRepository()
repo.ImportDir("data/params-override-project")
repo.GitAddAll()
repo.GitCommit("Point of inception")
proj, err := bzk.Api.Project.Create("param-proj", "git", repo.CloneURL())
require.NoError(t, err, "error while creating a project")
t.Logf("Created project: %v", proj.ID)
job, err := bzk.Api.Project.StartJob(proj.ID, "master", []string{"PARAM=42"})
require.NoError(t, err, "job creation failed")
t.Logf("Started job: %v", job)
jobStatus := bzk.WaitForJob(job.ID, 60*time.Second)
require.Equal(t, lib.JOB_SUCCESS, jobStatus)
}