Skip to content

Commit

Permalink
Merge pull request #8693 from krzyzacy/customize-guber
Browse files Browse the repository at this point in the history
allow overwrite gubernator path in unit test
  • Loading branch information
k8s-ci-robot authored Jul 16, 2018
2 parents 4874c2a + 08a6fe4 commit fe3b775
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions config/tests/jobs/jobs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type configJSON map[string]map[string]interface{}
var configPath = flag.String("config", "../../../prow/config.yaml", "Path to prow config")
var jobConfigPath = flag.String("job-config", "../../jobs", "Path to prow job config")
var configJSONPath = flag.String("config-json", "../../../jobs/config.json", "Path to prow job config")
var gubernatorPath = flag.String("gubernator-path", "https://k8s-gubernator.appspot.com", "Path to linked gubernator")

func (c configJSON) ScenarioForJob(jobName string) string {
if scenario, ok := c[jobName]["scenario"]; ok {
Expand Down Expand Up @@ -145,7 +146,7 @@ func TestReportTemplate(t *testing.T) {
t.Errorf("Error executing template: %v", err)
continue
}
expectedPath := "https://k8s-gubernator.appspot.com/pr/" + tc.suffix
expectedPath := *gubernatorPath + "/pr/" + tc.suffix
if !strings.Contains(b.String(), expectedPath) {
t.Errorf("Expected template to contain %s, but it didn't: %s", expectedPath, b.String())
}
Expand All @@ -169,7 +170,7 @@ func TestURLTemplate(t *testing.T) {
repo: "kubernetes",
job: "k8s-pre-1",
build: "1",
expect: "https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/pr-logs/pull/0/k8s-pre-1/1/",
expect: *gubernatorPath + "/build/kubernetes-jenkins/pr-logs/pull/0/k8s-pre-1/1/",
},
{
name: "k8s/test-infra presubmit",
Expand All @@ -178,7 +179,7 @@ func TestURLTemplate(t *testing.T) {
repo: "test-infra",
job: "ti-pre-1",
build: "1",
expect: "https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/pr-logs/pull/test-infra/0/ti-pre-1/1/",
expect: *gubernatorPath + "/build/kubernetes-jenkins/pr-logs/pull/test-infra/0/ti-pre-1/1/",
},
{
name: "foo/k8s presubmit",
Expand All @@ -187,7 +188,7 @@ func TestURLTemplate(t *testing.T) {
repo: "kubernetes",
job: "k8s-pre-1",
build: "1",
expect: "https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/pr-logs/pull/foo_kubernetes/0/k8s-pre-1/1/",
expect: *gubernatorPath + "/build/kubernetes-jenkins/pr-logs/pull/foo_kubernetes/0/k8s-pre-1/1/",
},
{
name: "foo-bar presubmit",
Expand All @@ -196,7 +197,7 @@ func TestURLTemplate(t *testing.T) {
repo: "bar",
job: "foo-pre-1",
build: "1",
expect: "https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/pr-logs/pull/foo_bar/0/foo-pre-1/1/",
expect: *gubernatorPath + "/build/kubernetes-jenkins/pr-logs/pull/foo_bar/0/foo-pre-1/1/",
},
{
name: "k8s postsubmit",
Expand All @@ -205,21 +206,21 @@ func TestURLTemplate(t *testing.T) {
repo: "kubernetes",
job: "k8s-post-1",
build: "1",
expect: "https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/logs/k8s-post-1/1/",
expect: *gubernatorPath + "/build/kubernetes-jenkins/logs/k8s-post-1/1/",
},
{
name: "k8s periodic",
jobType: kube.PeriodicJob,
job: "k8s-peri-1",
build: "1",
expect: "https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/logs/k8s-peri-1/1/",
expect: *gubernatorPath + "/build/kubernetes-jenkins/logs/k8s-peri-1/1/",
},
{
name: "empty periodic",
jobType: kube.PeriodicJob,
job: "nan-peri-1",
build: "1",
expect: "https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/logs/nan-peri-1/1/",
expect: *gubernatorPath + "/build/kubernetes-jenkins/logs/nan-peri-1/1/",
},
{
name: "k8s batch",
Expand All @@ -228,7 +229,7 @@ func TestURLTemplate(t *testing.T) {
repo: "kubernetes",
job: "k8s-batch-1",
build: "1",
expect: "https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/pr-logs/pull/batch/k8s-batch-1/1/",
expect: *gubernatorPath + "/build/kubernetes-jenkins/pr-logs/pull/batch/k8s-batch-1/1/",
},
}

Expand Down

0 comments on commit fe3b775

Please sign in to comment.