diff --git a/server/resource/commit/manager_test.go b/server/resource/commit/manager_test.go index 75f456f4..85c969eb 100644 --- a/server/resource/commit/manager_test.go +++ b/server/resource/commit/manager_test.go @@ -2,7 +2,6 @@ package commit import ( "database/sql" - "strings" "testing" "time" @@ -153,8 +152,8 @@ func TestInsert(t *testing.T) { // verify unique remote + remote id constraint err = commits.Insert(&Commit{RepoID: 3, Branch: "bar", Sha: "85f8c029b902ed9400bc600bac301a0aadb144ac"}) - if err == nil || !strings.Contains(err.Error(), "commit_sha, commit_branch, repo_id are not unique") { - t.Errorf("Want unique constraint violated, got %s", err) + if err == nil { + t.Error("Want unique constraint violated") } } diff --git a/server/resource/repo/manager_test.go b/server/resource/repo/manager_test.go index c5086e77..ed716ada 100644 --- a/server/resource/repo/manager_test.go +++ b/server/resource/repo/manager_test.go @@ -2,7 +2,6 @@ package repo import ( "database/sql" - "strings" "testing" "github.com/drone/drone/server/database" @@ -81,8 +80,8 @@ func TestInsert(t *testing.T) { // verify unique remote + owner + name login constraint var err = repos.Insert(&Repo{Host: repo.Host, Owner: repo.Owner, Name: repo.Name}) - if err == nil || !strings.Contains(err.Error(), "repo_host, repo_owner, repo_name are not unique") { - t.Errorf("Want unique constraint violated, got %s", err) + if err == nil { + t.Error("Want unique constraint violated") } } diff --git a/server/resource/user/manager_test.go b/server/resource/user/manager_test.go index f9786120..7ba384ba 100644 --- a/server/resource/user/manager_test.go +++ b/server/resource/user/manager_test.go @@ -2,7 +2,6 @@ package user import ( "database/sql" - "strings" "testing" "github.com/drone/drone/server/database" @@ -99,14 +98,14 @@ func TestInsert(t *testing.T) { // verify unique remote + remote login constraint var err = users.Insert(&User{Remote: user.Remote, Login: user.Login, Token: "f71eb4a81a2cca56035dd7f6f2942e41"}) - if err == nil || !strings.Contains(err.Error(), "user_remote, user_login are not unique") { - t.Errorf("Want Token unique constraint violated, got %s", err) + if err == nil { + t.Error("Want Token unique constraint violated") } // verify unique token constraint err = users.Insert(&User{Remote: "gitlab.com", Login: user.Login, Token: user.Token}) - if err == nil || !strings.Contains(err.Error(), "user_token is not unique") { - t.Errorf("Want Token unique constraint violated, got %s", err) + if err == nil { + t.Error("Want Token unique constraint violated") } } diff --git a/shared/deploy/bash_test.go b/shared/deploy/bash_test.go index 7c3205b2..8af86661 100644 --- a/shared/deploy/bash_test.go +++ b/shared/deploy/bash_test.go @@ -6,7 +6,7 @@ import ( "github.com/drone/drone/shared/build/buildfile" - "launchpad.net/goyaml" + "gopkg.in/yaml.v1" ) // emulate Build struct @@ -39,7 +39,7 @@ deploy: func setUpWithBash(input string) (string, error) { var buildStruct buildWithBash - err := goyaml.Unmarshal([]byte(input), &buildStruct) + err := yaml.Unmarshal([]byte(input), &buildStruct) if err != nil { return "", err } diff --git a/shared/deploy/cloudfoundry_test.go b/shared/deploy/cloudfoundry_test.go index 869e15af..91891f86 100644 --- a/shared/deploy/cloudfoundry_test.go +++ b/shared/deploy/cloudfoundry_test.go @@ -6,7 +6,7 @@ import ( "github.com/drone/drone/shared/build/buildfile" - "launchpad.net/goyaml" + "gopkg.in/yaml.v1" ) // emulate Build struct @@ -52,7 +52,7 @@ deploy: func setUpWithCF(input string) (string, error) { var buildStruct DeployToCF - err := goyaml.Unmarshal([]byte(input), &buildStruct) + err := yaml.Unmarshal([]byte(input), &buildStruct) if err != nil { return "", err } diff --git a/shared/deploy/ssh_test.go b/shared/deploy/ssh_test.go index c672c1da..46ee3956 100644 --- a/shared/deploy/ssh_test.go +++ b/shared/deploy/ssh_test.go @@ -6,7 +6,7 @@ import ( "github.com/drone/drone/shared/build/buildfile" - "launchpad.net/goyaml" + "gopkg.in/yaml.v1" ) // emulate Build struct @@ -51,7 +51,7 @@ deploy: func setUp(input string) (string, error) { var buildStruct build - err := goyaml.Unmarshal([]byte(input), &buildStruct) + err := yaml.Unmarshal([]byte(input), &buildStruct) if err != nil { return "", err } diff --git a/shared/publish/npm_test.go b/shared/publish/npm_test.go index daf9dace..388e743e 100644 --- a/shared/publish/npm_test.go +++ b/shared/publish/npm_test.go @@ -6,7 +6,7 @@ import ( "github.com/drone/drone/shared/build/buildfile" - "launchpad.net/goyaml" + "gopkg.in/yaml.v1" ) // emulate Build struct @@ -44,7 +44,7 @@ publish: func setUpWithNPM(input string) (string, error) { var buildStruct PublishToNPM - err := goyaml.Unmarshal([]byte(input), &buildStruct) + err := yaml.Unmarshal([]byte(input), &buildStruct) if err != nil { return "", err }