Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

Commit

Permalink
correct test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
farthir committed Jun 18, 2019
1 parent f763e98 commit 9701095
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
10 changes: 5 additions & 5 deletions cli/pipeline/pipeline_definition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ func TestParsePipeline(t *testing.T) {
if err != nil {
panic(err.Error())
}
pipeline := parsePipeline(data)
pipeline := ParsePipeline(data)

if len(pipeline.Steps) != 2 {
t.Errorf("excepted two steps, got %d", len(pipeline.Steps))
t.Errorf("expected two steps, got %d", len(pipeline.Steps))
}

if pipeline.Bucket != "canoe-sample-pipeline" {
Expand All @@ -26,7 +26,7 @@ func TestOverrideTag(t *testing.T) {
if err != nil {
panic(err.Error())
}
pipeline := parsePipeline(data)
pipeline := ParsePipeline(data)

pipeline.Steps[0].OverrideTag("")

Expand All @@ -46,7 +46,7 @@ func TestOverrideVersion(t *testing.T) {
if err != nil {
panic(err.Error())
}
pipeline := parsePipeline(data)
pipeline := ParsePipeline(data)

pipeline.Steps[0].OverrideVersion("", true)

Expand All @@ -70,7 +70,7 @@ func TestOverrideBranch(t *testing.T) {
if err != nil {
panic(err.Error())
}
pipeline := parsePipeline(data)
pipeline := ParsePipeline(data)

pipeline.Steps[0].OverrideBranch("", true)

Expand Down
17 changes: 9 additions & 8 deletions cli/pipeline/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ package pipeline

import (
"fmt"
"k8s.io/api/core/v1"
"testing"
"time"

v1 "k8s.io/api/core/v1"
k8errors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/kubernetes/fake"
ktesting "k8s.io/client-go/testing"
"testing"
"time"
)

func parseTimeOrDie(ts string) metav1.Time {
Expand Down Expand Up @@ -112,11 +113,11 @@ func TestRunPipelineSuccess(t *testing.T) {
expectPods := [2]string{"sample-steps-passing-version1-step1-master", "sample-steps-passing-version1a-step2-master"}

for _, p := range expectPods {
if deleted[p] != 2 {
t.Errorf("excepted delete of "+p+" to be called twice, got %i", deleted[p])
if deleted[p] != 3 {
t.Errorf("expected delete of "+p+" to be called twice, got %i", deleted[p])
}
if created[p] != 1 {
t.Errorf("excepted create of "+p+" to be called once, got %i", created[p])
t.Errorf("expected create of "+p+" to be called once, got %i", created[p])
}
}
}
Expand Down Expand Up @@ -162,7 +163,7 @@ func TestRunPipelineFailure(t *testing.T) {
runPipeline("test/sample_steps_passing.yml", testRunFlags)

if len(errors) != 2 {
t.Errorf("excepted two errors, actual %v", len(errors))
t.Errorf("expected two errors, actual %v", len(errors))
}
}

Expand Down Expand Up @@ -205,7 +206,7 @@ func TestRunPipelineStartTimeout(t *testing.T) {
runPipeline("test/sample_steps_passing.yml", &flags)

if len(errors) != 2 {
t.Errorf("excepted two errors, actual %v", len(errors))
t.Errorf("expected two errors, actual %v", len(errors))
}
msg := "[paddle] [Timed out waiting for pod to start. Cluster might not have sufficient resources.]"
for _, err := range errors {
Expand Down
8 changes: 4 additions & 4 deletions cli/pipeline/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"io/ioutil"
"testing"

"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/yaml"
)

Expand All @@ -13,7 +13,7 @@ func TestCompileTemplate(t *testing.T) {
if err != nil {
panic(err.Error())
}
pipeline := parsePipeline(data)
pipeline := ParsePipeline(data)

podDefinition := NewPodDefinition(pipeline, &pipeline.Steps[0])

Expand All @@ -36,7 +36,7 @@ func TestSecrets(t *testing.T) {
if err != nil {
panic(err.Error())
}
pipeline := parsePipeline(data)
pipeline := ParsePipeline(data)

podDefinition := NewPodDefinition(pipeline, &pipeline.Steps[0])
secrets := []string{"ENV_VAR:secret_store:key_name"}
Expand Down Expand Up @@ -68,7 +68,7 @@ func TestEnv(t *testing.T) {
if err != nil {
panic(err.Error())
}
pipeline := parsePipeline(data)
pipeline := ParsePipeline(data)

podDefinition := NewPodDefinition(pipeline, &pipeline.Steps[0])
env := []string{"ENV_VAR:env_value"}
Expand Down

0 comments on commit 9701095

Please sign in to comment.