Skip to content

Commit

Permalink
Merge pull request #21 from go-vela/bug/repo
Browse files Browse the repository at this point in the history
Update go-vela/types for Repo field rename
  • Loading branch information
wass3r committed Nov 13, 2019
2 parents 0538f9d + a350a15 commit 2773473
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 86 deletions.
1 change: 1 addition & 0 deletions database/ddl/postgres/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ secrets (
value BYTEA,
images VARCHAR(1000),
events VARCHAR(1000),
allow_command BOOLEAN,
UNIQUE(type, org, repo, name),
UNIQUE(type, org, team, name)
);
Expand Down
1 change: 1 addition & 0 deletions database/ddl/sqlite/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ secrets (
value TEXT,
images TEXT,
events TEXT,
allow_command BOOLEAN,
UNIQUE(type, org, repo, name),
UNIQUE(type, org, team, name)
);
Expand Down
20 changes: 11 additions & 9 deletions database/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,15 +628,17 @@ func testSecret() *library.Secret {
i64 := int64(0)
str := ""
arr := []string{}
booL := false
return &library.Secret{
ID: &i64,
Org: &str,
Repo: &str,
Team: &str,
Name: &str,
Value: &str,
Type: &str,
Images: &arr,
Events: &arr,
ID: &i64,
Org: &str,
Repo: &str,
Team: &str,
Name: &str,
Value: &str,
Type: &str,
Images: &arr,
Events: &arr,
AllowCommand: &booL,
}
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ require (
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/gin-gonic/gin v1.4.0
github.com/go-redis/redis v6.15.6+incompatible
github.com/go-vela/compiler v0.1.4
github.com/go-vela/types v0.1.2
github.com/go-vela/compiler v0.1.5
github.com/go-vela/types v0.1.3
github.com/google/go-cmp v0.3.1
github.com/google/go-github/v26 v26.1.3
github.com/google/uuid v1.1.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZp
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/go-vela/compiler v0.1.4 h1:3otdK/ATLIRdogCZtnqBzwxM78kcry1KFShYeRy7u8Y=
github.com/go-vela/compiler v0.1.4/go.mod h1:4c2Erqdq5eirc6km/KJduoN5F5M/96AlXi95LAQZBq4=
github.com/go-vela/types v0.1.2 h1:1YyjLJNREMiEkI8KH2bGICz7jihvsROTjFm8TaoaY7E=
github.com/go-vela/types v0.1.2/go.mod h1:JR5jxRuE5A+RZyyQqMd4lJoUApVFo/Iq9iABbQzPCj0=
github.com/go-vela/compiler v0.1.5 h1:6zrW7ydyId7KMkYpYi51Dm7ZQMuwByCfcnJqyWR7ZOQ=
github.com/go-vela/compiler v0.1.5/go.mod h1:gzPGewolyck47FSmZapgo5rU2OvAECrlTyxUGlnWZ0g=
github.com/go-vela/types v0.1.3 h1:y7PRarTVNZdu9x8v3vah+0+hB4NuNHYqY5Uq6MVJ04U=
github.com/go-vela/types v0.1.3/go.mod h1:JR5jxRuE5A+RZyyQqMd4lJoUApVFo/Iq9iABbQzPCj0=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down
78 changes: 43 additions & 35 deletions secret/native/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ func TestNative_Create_Org(t *testing.T) {
value := "baz"
typee := "org"
arr := []string{"foo", "bar"}
booL := false
want := &library.Secret{
ID: &one,
Org: &org,
Repo: &repo,
Team: &team,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
ID: &one,
Org: &org,
Repo: &repo,
Team: &team,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
AllowCommand: &booL,
}

// setup database
Expand Down Expand Up @@ -70,16 +72,18 @@ func TestNative_Create_Repo(t *testing.T) {
value := "foob"
typee := "repo"
arr := []string{"foo", "bar"}
booL := false
want := &library.Secret{
ID: &one,
Org: &org,
Repo: &repo,
Team: &team,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
ID: &one,
Org: &org,
Repo: &repo,
Team: &team,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
AllowCommand: &booL,
}

// setup database
Expand Down Expand Up @@ -117,16 +121,18 @@ func TestNative_Create_Shared(t *testing.T) {
value := "foob"
typee := "shared"
arr := []string{"foo", "bar"}
booL := false
want := &library.Secret{
ID: &one,
Org: &org,
Repo: &repo,
Team: &team,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
ID: &one,
Org: &org,
Repo: &repo,
Team: &team,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
AllowCommand: &booL,
}

// setup database
Expand Down Expand Up @@ -163,15 +169,17 @@ func TestNative_Create_Invalid(t *testing.T) {
value := "foob"
typee := "invalid"
arr := []string{"foo", "bar"}
booL := false
sec := &library.Secret{
ID: &one,
Org: &org,
Repo: &repo,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
ID: &one,
Org: &org,
Repo: &repo,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
AllowCommand: &booL,
}

// setup database
Expand Down
20 changes: 11 additions & 9 deletions secret/native/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ func TestNative_Get(t *testing.T) {
value := "foob"
typee := "repo"
arr := []string{"foo", "bar"}
booL := false
want := &library.Secret{
ID: &one,
Org: &org,
Repo: &repo,
Team: &team,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
ID: &one,
Org: &org,
Repo: &repo,
Team: &team,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
AllowCommand: &booL,
}

// setup database
Expand Down
39 changes: 21 additions & 18 deletions secret/native/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,31 @@ func TestNative_List(t *testing.T) {
value := "foob"
typee := "repo"
arr := []string{"foo", "bar"}
booL := false
sOne := &library.Secret{
ID: &one,
Org: &org,
Repo: &repo,
Team: &team,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
ID: &one,
Org: &org,
Repo: &repo,
Team: &team,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
AllowCommand: &booL,
}
two := int64(2)
sTwo := &library.Secret{
ID: &two,
Org: &org,
Repo: &repo,
Team: &team,
Name: &value,
Value: &name,
Type: &typee,
Images: &arr,
Events: &arr,
ID: &two,
Org: &org,
Repo: &repo,
Team: &team,
Name: &value,
Value: &name,
Type: &typee,
Images: &arr,
Events: &arr,
AllowCommand: &booL,
}
want := []*library.Secret{sTwo, sOne}

Expand Down
20 changes: 11 additions & 9 deletions secret/native/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ func TestNative_Update(t *testing.T) {
value := "foob"
typee := "repo"
arr := []string{"foo", "bar"}
booL := false
want := &library.Secret{
ID: &one,
Org: &org,
Repo: &repo,
Team: &team,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
ID: &one,
Org: &org,
Repo: &repo,
Team: &team,
Name: &name,
Value: &value,
Type: &typee,
Images: &arr,
Events: &arr,
AllowCommand: &booL,
}

// setup database
Expand Down

0 comments on commit 2773473

Please sign in to comment.