-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
With the refactors going on there was some dead code, some code that could be easult replaced by generics, and some test code that was doing things differently than the more recent stuff. There's likely more to do in this vein, but this was a bit of a timeboxed effort.
- Loading branch information
Showing
20 changed files
with
142 additions
and
341 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
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
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 |
---|---|---|
@@ -1,22 +1,46 @@ | ||
package honeycombio | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"regexp" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
|
||
honeycombio "github.com/honeycombio/terraform-provider-honeycombio/client" | ||
) | ||
|
||
func TestAccDataSourceHoneycombioTriggerRecipient_basic(t *testing.T) { | ||
ctx := context.Background() | ||
dataset := testAccDataset() | ||
c := testAccClient(t) | ||
|
||
_, deleteFn := createTriggerWithRecipient(t, dataset, honeycombio.NotificationRecipient{ | ||
Type: honeycombio.RecipientTypeEmail, | ||
Target: "[email protected]", | ||
trigger, err := c.Triggers.Create(ctx, dataset, &honeycombio.Trigger{ | ||
Name: "test trigger", | ||
Query: &honeycombio.QuerySpec{ | ||
Calculations: []honeycombio.CalculationSpec{ | ||
{Op: honeycombio.CalculationOpCount}, | ||
}, | ||
}, | ||
Threshold: &honeycombio.TriggerThreshold{ | ||
Op: honeycombio.TriggerThresholdOpGreaterThan, | ||
Value: 100, | ||
}, | ||
Recipients: []honeycombio.NotificationRecipient{ | ||
{ | ||
Type: honeycombio.RecipientTypeEmail, | ||
Target: "[email protected]", | ||
}, | ||
}, | ||
}) | ||
require.NoError(t, err) | ||
//nolint:errcheck | ||
t.Cleanup(func() { | ||
c.Triggers.Delete(ctx, dataset, trigger.ID) | ||
}) | ||
defer deleteFn() | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: testAccPreCheck(t), | ||
|
@@ -41,7 +65,7 @@ func testAccTriggerRecipient(dataset, recipientType, target string) string { | |
return fmt.Sprintf(` | ||
data "honeycombio_trigger_recipient" "test" { | ||
dataset = "%s" | ||
type = "%s" | ||
target = "%s" | ||
type = "%s" | ||
target = "%s" | ||
}`, dataset, recipientType, target) | ||
} |
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.