Skip to content

Commit

Permalink
Merge pull request #11 from Dalee/fix-rollback-command
Browse files Browse the repository at this point in the history
fix rollback command
  • Loading branch information
arkady-emelyanov authored Aug 23, 2017
2 parents dc16bee + ed07e89 commit 2ac97ad
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: go
go:
- "1.7.x"
- "1.8.x"

go_import_path: fuse

Expand Down
2 changes: 1 addition & 1 deletion bin/cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func finalizeRollOut(specList *[]kubectl.Deployment, isRolledOut bool) error {
fmt.Println("==> Rollout failed, starting undo process...")
for _, d := range *rolledList {
// get list of replica sets connected to deployment
rlist, err := kubectl.CommandReplicaSetListBySelector(d.GetNamespace(), d.GetPodSelector()).RunAndParse()
rlist, err := kubectl.CommandReplicaSetListBySelector(d.GetNamespace(), d.GetSelector()).RunAndParse()
if err != nil {
return err
}
Expand Down
24 changes: 23 additions & 1 deletion pkg/kubectl/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ import (
"testing"
)

func CompareStringSlices(l, r []string) bool {
if len(l) != len(r) {
return false
}

for _, leftItem := range l {
found := false
for _, rightItem := range r {
if leftItem == rightItem {
found = true
}
}

if !found {
return false
}
}

return true
}

func TestNamespace_Type(t *testing.T) {
ns := Namespace{
Kind: "Namespace",
Expand Down Expand Up @@ -87,7 +108,8 @@ func TestDeployment_Type(t *testing.T) {
assert.Equal(t, "test-deployment", d.GetName())
assert.Equal(t, "3eb259fc-bc6f-11e6-a342-005056ba5444", d.GetUUID())
assert.Equal(t, "default/test-deployment", d.GetKey())
assert.Equal(t, []string{"project=test-project-2", "project_build=12"}, d.GetPodSelector())
assert.True(t, CompareStringSlices([]string{"sample-label1=example1"}, d.GetSelector()))
assert.True(t, CompareStringSlices([]string{"project=test-project-2", "project_build=12"}, d.GetPodSelector()))
assert.False(t, d.IsReady())
assert.Equal(t, "Ready: false, Generation: meta=12 observed=0, Replicas: s=1, u=0, a=0, na=1", d.GetStatusString())

Expand Down

0 comments on commit 2ac97ad

Please sign in to comment.