-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from axiomhq/fix_data_notifier
fix(notifier): fixed pointer struct value when using data "axiom_notifier"
- Loading branch information
Showing
9 changed files
with
51 additions
and
1,066 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,3 +135,44 @@ func testAccAxiomDatasetConfig_basic() string { | |
} | ||
` | ||
} | ||
|
||
func TestAccAxiomResources_data(t *testing.T) { | ||
client, err := ax.NewClient() | ||
assert.NoError(t, err) | ||
|
||
emailToAssert := "[email protected]" | ||
n, err := client.Notifiers.Create(context.Background(), ax.Notifier{Name: "my notifier", Properties: ax.NotifierProperties{Email: &ax.EmailConfig{ | ||
Emails: []string{emailToAssert}, | ||
}}}) | ||
|
||
defer func() { | ||
assert.NoError(t, client.Notifiers.Delete(context.Background(), n.ID)) | ||
}() | ||
|
||
assert.NoError(t, err) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
ProtoV6ProviderFactories: map[string]func() (tfprotov6.ProviderServer, error){ | ||
"axiom": providerserver.NewProtocol6WithError(NewAxiomProvider()), | ||
}, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: ` | ||
provider "axiom" { | ||
api_token = "` + os.Getenv("AXIOM_TOKEN") + `" | ||
org_id = "` + os.Getenv("AXIOM_ORG_ID") + `" | ||
base_url = "` + os.Getenv("AXIOM_URL") + `" | ||
} | ||
data "axiom_notifier" "my-notifier" { | ||
id = "` + n.ID + `" | ||
} | ||
`, | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr("data.axiom_notifier.my-notifier", "properties.email.emails.#", "1"), | ||
resource.TestCheckResourceAttr("data.axiom_notifier.my-notifier", "properties.email.emails.0", emailToAssert), | ||
), | ||
}, | ||
}, | ||
}) | ||
} |
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
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
Oops, something went wrong.