-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
156 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
tests/flowpipe_invalid_tests/pipelines/approval_invalid_notify_attribute.fp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
integration "slack" "my_slack_app" { | ||
token = "xoxp-111111" | ||
|
||
# optional - if you want to verify the source | ||
signing_secret = "Q#$$#@#$$#W" | ||
} | ||
|
||
pipeline "approval" { | ||
step "input" "input" { | ||
notify { | ||
integration = integration.slack.my_slack_app | ||
bad_attribute = "foo" | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/flowpipe_invalid_tests/pipelines/approval_invalid_notify_email.fp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
integration "email" "email_integration" { | ||
smtp_host = "foo bar baz" | ||
default_subject = "bar foo baz" | ||
smtp_username = "baz bar foo" | ||
} | ||
|
||
pipeline "approval" { | ||
step "input" "input" { | ||
notify { | ||
integration = integration.email.email_integration | ||
channel = "foo" | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/flowpipe_invalid_tests/pipelines/approval_invalid_notify_slack.fp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
integration "slack" "my_slack_app" { | ||
token = "xoxp-111111" | ||
|
||
# optional - if you want to verify the source | ||
signing_secret = "Q#$$#@#$$#W" | ||
} | ||
|
||
pipeline "approval" { | ||
step "input" "input" { | ||
notify { | ||
integration = integration.slack.my_slack_app | ||
to = "foo" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,11 +63,26 @@ func TestApproval(t *testing.T) { | |
assert.NotNil(integrationMap) | ||
assert.Equal("xoxp-111111", integrationMap["token"].AsString()) | ||
|
||
assert.Equal("remove this after integrated", *inputStep.Token) | ||
|
||
inputsAfterEval, err := inputStep.GetInputs(&hcl.EvalContext{}) | ||
// the notify should override the inline definition (the inline definition should not be there after integrated 2023) | ||
assert.Nil(err) | ||
|
||
assert.Equal("xoxp-111111", inputsAfterEval["token"].(string)) | ||
|
||
pipeline = mod.ResourceMaps.Pipelines["local.pipeline.approval_email"] | ||
if pipeline == nil { | ||
assert.Fail("Pipeline not found") | ||
return | ||
} | ||
|
||
inputStep, ok = pipeline.Steps[0].(*modconfig.PipelineStepInput) | ||
if !ok { | ||
assert.Fail("Pipeline step not found") | ||
return | ||
} | ||
|
||
assert.Equal("input_email", inputStep.Name) | ||
assert.NotNil(inputStep.Notify) | ||
assert.Equal("[email protected]", *inputStep.Notify.To) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,21 +22,32 @@ integration "email" "email_integration" { | |
|
||
pipeline "approval" { | ||
step "input" "input" { | ||
token = "remove this after integrated" | ||
|
||
notify { | ||
integration = integration.slack.my_slack_app | ||
channel = "foo" | ||
} | ||
} | ||
} | ||
|
||
pipeline "approval_email" { | ||
step "input" "input_email" { | ||
|
||
notify { | ||
integration = integration.email.email_integration | ||
to = "[email protected]" | ||
} | ||
} | ||
} | ||
|
||
// TODO: param doesn't work yet | ||
pipeline "approval_dynamic_integration" { | ||
|
||
param "integration_param" { | ||
} | ||
|
||
step "input" "input" { | ||
token = "remove this after integrated" | ||
|
||
notify { | ||
integration = integration.slack.my_slack_app | ||
channel = "foo" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,6 @@ | |
|
||
integration "slack" "my_slack_app" { | ||
token = "xoxp-111111" | ||
|
||
# optional - if you want to verify the source | ||
signing_secret = "Q#$$#@#$$#W" | ||
} | ||
|
||
integration "slack" "my_slack_app_two" { | ||
token = "xoxp-111111" | ||
|
||
# optional - if you want to verify the source | ||
signing_secret = "Q#$$#@#$$#W" | ||
} | ||
|
@@ -36,13 +28,14 @@ pipeline "approval_with_notifies" { | |
{ | ||
integration = integration.slack.my_slack_app | ||
channel = "foo" | ||
to = "[email protected]" | ||
# channel = param.slack_channel | ||
|
||
# if = param.slack_integration == null ? false : true | ||
}, | ||
{ | ||
integration = integration.email.email_integration | ||
to = "[email protected]" | ||
channel = "bar" | ||
} | ||
] | ||
} | ||
|
@@ -68,7 +61,6 @@ pipeline "approval_with_notifies_depend_another_step" { | |
integration = integration.slack.my_slack_app | ||
channel = step.echo.echo.text | ||
# channel = param.slack_channel | ||
|
||
# if = param.slack_integration == null ? false : true | ||
}, | ||
{ | ||
|