Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for team notification configurations #1016

Merged
merged 11 commits into from
Jan 8, 2025

Conversation

jfreda
Copy link
Member

@jfreda jfreda commented Dec 5, 2024

Description

This PR adds support for team notification configurations.

External links

Output from tests

$ ENABLE_BETA=1 go test ./... -run 'TestTeamNotificationConfiguration' -v
=== RUN   TestTeamNotificationConfigurationList
=== RUN   TestTeamNotificationConfigurationList/with_a_valid_team
    team_notification_configuration_integration_test.go:43: paging not supported yet in API
=== RUN   TestTeamNotificationConfigurationList/with_list_options
    team_notification_configuration_integration_test.go:49: paging not supported yet in API
=== RUN   TestTeamNotificationConfigurationList/without_a_valid_team
--- PASS: TestTeamNotificationConfigurationList (1.88s)
    --- SKIP: TestTeamNotificationConfigurationList/with_a_valid_team (0.15s)
    --- SKIP: TestTeamNotificationConfigurationList/with_list_options (0.00s)
    --- PASS: TestTeamNotificationConfigurationList/without_a_valid_team (0.00s)
=== RUN   TestTeamNotificationConfigurationCreate
=== RUN   TestTeamNotificationConfigurationCreate/with_all_required_values
=== RUN   TestTeamNotificationConfigurationCreate/without_a_required_value
=== RUN   TestTeamNotificationConfigurationCreate/without_a_required_value_URL_when_destination_type_is_generic
=== RUN   TestTeamNotificationConfigurationCreate/without_a_required_value_URL_when_destination_type_is_slack
=== RUN   TestTeamNotificationConfigurationCreate/without_a_required_value_URL_when_destination_type_is_MS_Teams
=== RUN   TestTeamNotificationConfigurationCreate/without_a_valid_team
=== RUN   TestTeamNotificationConfigurationCreate/with_an_invalid_notification_trigger
=== RUN   TestTeamNotificationConfigurationCreate/with_email_users_when_destination_type_is_email
=== RUN   TestTeamNotificationConfigurationCreate/without_email_users_when_destination_type_is_email
--- PASS: TestTeamNotificationConfigurationCreate (3.11s)
    --- PASS: TestTeamNotificationConfigurationCreate/with_all_required_values (0.15s)
    --- PASS: TestTeamNotificationConfigurationCreate/without_a_required_value (0.00s)
    --- PASS: TestTeamNotificationConfigurationCreate/without_a_required_value_URL_when_destination_type_is_generic (0.00s)
    --- PASS: TestTeamNotificationConfigurationCreate/without_a_required_value_URL_when_destination_type_is_slack (0.00s)
    --- PASS: TestTeamNotificationConfigurationCreate/without_a_required_value_URL_when_destination_type_is_MS_Teams (0.00s)
    --- PASS: TestTeamNotificationConfigurationCreate/without_a_valid_team (0.00s)
    --- PASS: TestTeamNotificationConfigurationCreate/with_an_invalid_notification_trigger (0.00s)
    --- PASS: TestTeamNotificationConfigurationCreate/with_email_users_when_destination_type_is_email (0.21s)
    --- PASS: TestTeamNotificationConfigurationCreate/without_email_users_when_destination_type_is_email (0.19s)
=== RUN   TestTeamNotificationConfigurationsCreate_byType
=== PAUSE TestTeamNotificationConfigurationsCreate_byType
=== RUN   TestTeamNotificationConfigurationRead
=== RUN   TestTeamNotificationConfigurationRead/with_a_valid_ID
=== RUN   TestTeamNotificationConfigurationRead/when_the_notification_configuration_does_not_exist
=== RUN   TestTeamNotificationConfigurationRead/when_the_notification_configuration_ID_is_invalid
--- PASS: TestTeamNotificationConfigurationRead (1.94s)
    --- PASS: TestTeamNotificationConfigurationRead/with_a_valid_ID (0.16s)
    --- PASS: TestTeamNotificationConfigurationRead/when_the_notification_configuration_does_not_exist (0.11s)
    --- PASS: TestTeamNotificationConfigurationRead/when_the_notification_configuration_ID_is_invalid (0.00s)
=== RUN   TestTeamNotificationConfigurationUpdate
=== RUN   TestTeamNotificationConfigurationUpdate/with_options
=== RUN   TestTeamNotificationConfigurationUpdate/with_invalid_notification_trigger
=== RUN   TestTeamNotificationConfigurationUpdate/with_email_users_when_destination_type_is_email
=== RUN   TestTeamNotificationConfigurationUpdate/without_email_users_when_destination_type_is_email
=== RUN   TestTeamNotificationConfigurationUpdate/without_options
=== RUN   TestTeamNotificationConfigurationUpdate/when_the_notification_configuration_does_not_exist
=== RUN   TestTeamNotificationConfigurationUpdate/when_the_notification_configuration_ID_is_invalid
--- PASS: TestTeamNotificationConfigurationUpdate (6.76s)
    --- PASS: TestTeamNotificationConfigurationUpdate/with_options (0.73s)
    --- PASS: TestTeamNotificationConfigurationUpdate/with_invalid_notification_trigger (0.00s)
    --- PASS: TestTeamNotificationConfigurationUpdate/with_email_users_when_destination_type_is_email (0.21s)
    --- PASS: TestTeamNotificationConfigurationUpdate/without_email_users_when_destination_type_is_email (0.20s)
    --- PASS: TestTeamNotificationConfigurationUpdate/without_options (0.39s)
    --- PASS: TestTeamNotificationConfigurationUpdate/when_the_notification_configuration_does_not_exist (0.14s)
    --- PASS: TestTeamNotificationConfigurationUpdate/when_the_notification_configuration_ID_is_invalid (0.00s)
=== RUN   TestTeamNotificationConfigurationDelete
=== RUN   TestTeamNotificationConfigurationDelete/with_a_valid_ID
=== RUN   TestTeamNotificationConfigurationDelete/when_the_notification_configuration_does_not_exist
=== RUN   TestTeamNotificationConfigurationDelete/when_the_notification_configuration_ID_is_invalid
--- PASS: TestTeamNotificationConfigurationDelete (2.22s)
    --- PASS: TestTeamNotificationConfigurationDelete/with_a_valid_ID (0.30s)
    --- PASS: TestTeamNotificationConfigurationDelete/when_the_notification_configuration_does_not_exist (0.13s)
    --- PASS: TestTeamNotificationConfigurationDelete/when_the_notification_configuration_ID_is_invalid (0.00s)
=== RUN   TestTeamNotificationConfigurationVerify
=== RUN   TestTeamNotificationConfigurationVerify/with_a_valid_ID
=== RUN   TestTeamNotificationConfigurationVerify/when_the_notification_configuration_does_not_exists
=== RUN   TestTeamNotificationConfigurationVerify/when_the_notification_configuration_ID_is_invalid
--- PASS: TestTeamNotificationConfigurationVerify (2.33s)
    --- PASS: TestTeamNotificationConfigurationVerify/with_a_valid_ID (0.39s)
    --- PASS: TestTeamNotificationConfigurationVerify/when_the_notification_configuration_does_not_exists (0.12s)
    --- PASS: TestTeamNotificationConfigurationVerify/when_the_notification_configuration_ID_is_invalid (0.00s)
=== CONT  TestTeamNotificationConfigurationsCreate_byType
=== RUN   TestTeamNotificationConfigurationsCreate_byType/with_trigger_change_request:created_and_all_required_values
=== PAUSE TestTeamNotificationConfigurationsCreate_byType/with_trigger_change_request:created_and_all_required_values
=== CONT  TestTeamNotificationConfigurationsCreate_byType/with_trigger_change_request:created_and_all_required_values
--- PASS: TestTeamNotificationConfigurationsCreate_byType (1.74s)
    --- PASS: TestTeamNotificationConfigurationsCreate_byType/with_trigger_change_request:created_and_all_required_values (0.14s)
PASS
ok  	github.com/hashicorp/go-tfe	20.447s

@jfreda
Copy link
Member Author

jfreda commented Dec 11, 2024

A fix for the linting error might be kind of weird IMO, but I can do it if any reviewers feel strongly about it (I saw in CONTRIBUTING.md that linting is not strictly required for these to pass; not sure if this would require an ignore to not be noisy in CI).

@datadog-terraform-cloud-hashicorp
Copy link

datadog-terraform-cloud-hashicorp bot commented Dec 16, 2024

Datadog Report

Branch report: jfreda/add-team-notification-configs
Commit report: 330b3de
Test service: hashicorp/go-tfe

✅ 0 Failed, 1421 Passed, 159 Skipped, 17m 45.78s Total Time
⬆️ Test Sessions change in coverage: 1 increased (+0.1%)

go.mod Outdated Show resolved Hide resolved
@@ -34,13 +34,16 @@ func TestNotificationConfigurationList(t *testing.T) {
assert.Contains(t, ncl.Items, ncTest1)
assert.Contains(t, ncl.Items, ncTest2)

t.Skip("paging not supported yet in API")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the skips for these tests. They work even though we don't really support pagination for these endpoints (we cap at 20 notification configurations maximum per subscribable).

run_trigger.go Outdated Show resolved Hide resolved
notchairmk added a commit that referenced this pull request Jan 7, 2025
…1027)

Prerequisite for #1016.

Bumps the jsonapi version to address a bug with interactions between `polyrelation` and deprecated `relation`.

Updates run triggers to backfill the deprecated Sourceable field in the RunTrigger struct.
brandonc
brandonc previously approved these changes Jan 8, 2025
notification_configuration.go Outdated Show resolved Hide resolved
@notchairmk notchairmk merged commit 7b0ffc9 into main Jan 8, 2025
7 checks passed
@notchairmk notchairmk deleted the jfreda/add-team-notification-configs branch January 8, 2025 20:24
Copy link

github-actions bot commented Jan 8, 2025

Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants