As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Unverified Commit 2cb9461f authored by Ash McKenzie's avatar Ash McKenzie
Browse files

Allow allowedPayloadPath to be provided

parent 95f34305
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -52,7 +52,7 @@ func buildExpectedResponse(who string) *Response {
}
func TestSuccessfulResponses(t *testing.T) {
client, cleanup := setup(t)
client, cleanup := setup(t, "")
defer cleanup()
testCases := []struct {
Loading
Loading
@@ -82,8 +82,8 @@ func TestSuccessfulResponses(t *testing.T) {
}
}
client, cleanup := setup(t)
func TestGeoPushGetCustomAction(t *testing.T) {
client, cleanup := setup(t, "responses/allowed_with_push_payload.json")
defer cleanup()
args := &commandargs.Shell{GitlabUsername: "custom"}
Loading
Loading
@@ -106,7 +106,7 @@ func TestGeoPushGetCustomAction(t *testing.T) {
}
func TestErrorResponses(t *testing.T) {
client, cleanup := setup(t)
client, cleanup := setup(t, "")
defer cleanup()
testCases := []struct {
Loading
Loading
@@ -142,7 +142,7 @@ func TestErrorResponses(t *testing.T) {
}
}
func setup(t *testing.T) (*Client, func()) {
func setup(t *testing.T, allowedPayload string) (*Client, func()) {
testDirCleanup, err := testhelper.PrepareTestRootDir()
require.NoError(t, err)
defer testDirCleanup()
Loading
Loading
@@ -150,9 +150,13 @@ func setup(t *testing.T) (*Client, func()) {
body, err := ioutil.ReadFile(path.Join(testhelper.TestRoot, "responses/allowed.json"))
require.NoError(t, err)
allowedWithPayloadPath := path.Join(testhelper.TestRoot, "responses/allowed_with_push_payload.json")
bodyWithPayload, err := ioutil.ReadFile(allowedWithPayloadPath)
require.NoError(t, err)
var bodyWithPayload []byte
if allowedPayload != "" {
allowedWithPayloadPath := path.Join(testhelper.TestRoot, allowedPayload)
bodyWithPayload, err = ioutil.ReadFile(allowedWithPayloadPath)
require.NoError(t, err)
}
requests := []testserver.TestRequestHandler{
{
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment