Skip to content

Commit

Permalink
pull in latest server + add testLibraryEvents temp func
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed Apr 10, 2024
1 parent 5e66aa5 commit 138bc2e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/buildkite/yaml v0.0.0-20230306222819-0e4e032d4835
github.com/coreos/go-semver v0.3.1
github.com/gin-gonic/gin v1.9.1
github.com/go-vela/server v0.23.4-0.20240405160933-fb31ea5a6e96
github.com/go-vela/server v0.23.4-0.20240410164628-1058d9696961
github.com/go-vela/types v0.23.4-0.20240405205548-f24f795ac0b7
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/google/go-cmp v0.6.0
Expand Down
2 changes: 1 addition & 1 deletion vela/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func TestAdmin_Secret_Update_200(t *testing.T) {
req := library.Secret{
Name: String("foo"),
Value: String("bar"),
AllowEvents: testEvents(),
AllowEvents: testLibraryEvents(),
}

// run test
Expand Down
29 changes: 29 additions & 0 deletions vela/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
api "github.com/go-vela/server/api/types"
"github.com/go-vela/server/mock/server"

"github.com/go-vela/types/library"
"github.com/go-vela/types/library/actions"

"github.com/gin-gonic/gin"
Expand Down Expand Up @@ -480,3 +481,31 @@ func testEvents() *api.Events {
},
}
}

// TODO: remove this once library.Secret is converted to api.Secret
func testLibraryEvents() *library.Events {
return &library.Events{
Push: &actions.Push{
Branch: Bool(true),
Tag: Bool(true),
DeleteBranch: Bool(true),
DeleteTag: Bool(true),
},
PullRequest: &actions.Pull{
Opened: Bool(true),
Edited: Bool(true),
Synchronize: Bool(true),
Reopened: Bool(true),
},
Deployment: &actions.Deploy{
Created: Bool(true),
},
Comment: &actions.Comment{
Created: Bool(true),
Edited: Bool(true),
},
Schedule: &actions.Schedule{
Run: Bool(true),
},
}
}
10 changes: 5 additions & 5 deletions vela/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func TestSecret_Add_201(t *testing.T) {
Name: String("foo"),
Value: String("bar"),
Images: &[]string{"foo", "bar"},
AllowEvents: testEvents(),
AllowEvents: testLibraryEvents(),
}

// run test
Expand Down Expand Up @@ -149,7 +149,7 @@ func TestSecret_Update_200(t *testing.T) {
req := library.Secret{
Name: String("foo"),
Value: String("bar"),
AllowEvents: testEvents(),
AllowEvents: testLibraryEvents(),
}

// run test
Expand Down Expand Up @@ -180,7 +180,7 @@ func TestSecret_Update_404(t *testing.T) {
req := library.Secret{
Name: String("foo"),
Value: String("bar"),
AllowEvents: testEvents(),
AllowEvents: testLibraryEvents(),
}

// run test
Expand Down Expand Up @@ -280,7 +280,7 @@ func ExampleSecretService_Add() {
Name: String("foo"),
Value: String("bar"),
Images: &[]string{"foo", "bar"},
AllowEvents: testEvents(),
AllowEvents: testLibraryEvents(),
}

// Create the secret in the server
Expand All @@ -302,7 +302,7 @@ func ExampleSecretService_Update() {
req := library.Secret{
Name: String("foo"),
Value: String("bar"),
AllowEvents: testEvents(),
AllowEvents: testLibraryEvents(),
}

// Update the secret in the server
Expand Down

0 comments on commit 138bc2e

Please sign in to comment.