Skip to content

Commit

Permalink
Merge branch 'main' into brooke.slack-regex-update
Browse files Browse the repository at this point in the history
  • Loading branch information
brookesargent authored Oct 8, 2024
2 parents e583faa + 246899e commit 78a9008
Show file tree
Hide file tree
Showing 24 changed files with 195 additions and 270 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
cache: true

- name: Lint
uses: golangci/[email protected].0
uses: golangci/[email protected].1
with:
version: latest

Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
show: "fail, skip"

- name: Generate Coverage Report
uses: codecov/codecov-action@v4.5.0
uses: codecov/codecov-action@v4.6.0
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand Down Expand Up @@ -210,6 +210,6 @@ jobs:
show: "fail, skip"

- name: Generate Coverage Report
uses: codecov/codecov-action@v4.5.0
uses: codecov/codecov-action@v4.6.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.21.12
1.22.7
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ linters:
enable:
- durationcheck
- errcheck
- exportloopref
- copyloopvar
- forcetypeassert
- goimports
- gosimple
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# 0.27.1 (Sep 03, 2024)

ENHANCEMENTS:

* chore(docs): standardize use of notes (#538)
* feat: slack channel regex accepts channel id (#540)

BUGFIXES:

* fix(r/trigger): handle dynamic evaluation schedule (#539)

# 0.27.0 (Aug 23, 2024)

NOTES:
Expand Down
2 changes: 1 addition & 1 deletion client/marker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestMarkers(t *testing.T) {
data := &client.Marker{
Message: fmt.Sprintf("Test run at %v", time.Now()),
Type: test.RandomStringWithPrefix("test.", 8),
URL: "http://example.com",
URL: test.RandomURL(),
StartTime: time.Now().Unix(),
}
m, err = c.Markers.Create(ctx, dataset, data)
Expand Down
6 changes: 3 additions & 3 deletions client/recipient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestRecipientsWebhooksandMSTeams(t *testing.T) {
Type: client.RecipientTypeWebhook,
Details: client.RecipientDetails{
WebhookName: test.RandomStringWithPrefix("test.", 10),
WebhookURL: "https://example.com",
WebhookURL: test.RandomURL(),
WebhookSecret: "secret",
},
},
Expand All @@ -105,7 +105,7 @@ func TestRecipientsWebhooksandMSTeams(t *testing.T) {
Type: client.RecipientTypeMSTeams,
Details: client.RecipientDetails{
WebhookName: test.RandomStringWithPrefix("test.", 10),
WebhookURL: "https://corp.office.com/webhook",
WebhookURL: test.RandomURL(),
},
},
expectErr: true, // creation of new MSTeams recipients is not allowed
Expand All @@ -115,7 +115,7 @@ func TestRecipientsWebhooksandMSTeams(t *testing.T) {
Type: client.RecipientTypeMSTeamsWorkflow,
Details: client.RecipientDetails{
WebhookName: test.RandomStringWithPrefix("test.", 10),
WebhookURL: "https://mycorp.westus.logic.azure.com/workflows/12345",
WebhookURL: test.RandomURL(),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion client/v2/api_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func TestClient_APIKeys_Pagination(t *testing.T) {
// create a bunch of keys
numKeys := int(math.Floor(1.5 * float64(defaultPageSize)))
testKeys := make([]*APIKey, numKeys)
for i := 0; i < numKeys; i++ {
for i := range numKeys {
k, err := c.APIKeys.Create(ctx, &APIKey{
Name: helper.ToPtr(fmt.Sprintf("test.%d", i)),
KeyType: "ingest",
Expand Down
2 changes: 1 addition & 1 deletion client/v2/environments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestClient_Environments_Pagination(t *testing.T) {
// create a bunch of environments
numEnvs := int(math.Floor(1.5 * float64(defaultPageSize)))
testEnvs := make([]*Environment, numEnvs)
for i := 0; i < numEnvs; i++ {
for i := range numEnvs {
e, err := c.Environments.Create(ctx, &Environment{
Name: test.RandomStringWithPrefix("test.", 20),
})
Expand Down
18 changes: 8 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
module github.com/honeycombio/terraform-provider-honeycombio

go 1.21

toolchain go1.21.7
go 1.22.7

require (
github.com/dunglas/httpsfv v1.0.2
github.com/google/go-querystring v1.1.0
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/hashicorp/jsonapi v1.3.2-0.20240802183744-2490a9451c3d
github.com/hashicorp/terraform-plugin-framework v1.11.0
github.com/hashicorp/terraform-plugin-go v0.23.0
github.com/hashicorp/terraform-plugin-framework v1.12.0
github.com/hashicorp/terraform-plugin-go v0.24.0
github.com/hashicorp/terraform-plugin-mux v0.16.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
github.com/hashicorp/terraform-plugin-testing v1.10.0
Expand All @@ -25,7 +23,7 @@ require (
github.com/cloudflare/circl v1.3.7 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect
)

require (
Expand All @@ -39,7 +37,7 @@ require (
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-plugin v1.6.1 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/hc-install v0.8.0 // indirect
Expand Down Expand Up @@ -67,11 +65,11 @@ require (
github.com/zclconf/go-cty v1.15.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.34.0 // indirect
google.golang.org/grpc v1.66.2 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
28 changes: 14 additions & 14 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 37 additions & 44 deletions honeycombio/data_source_column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,75 +4,68 @@ import (
"context"
"fmt"
"regexp"
"strings"
"testing"

"github.com/stretchr/testify/require"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"

honeycombio "github.com/honeycombio/terraform-provider-honeycombio/client"
"github.com/honeycombio/terraform-provider-honeycombio/internal/helper/test"
)

func TestAccDataSourceHoneycombioColumn_basic(t *testing.T) {
ctx := context.Background()
c := testAccClient(t)
dataset := testAccDataset()

testColumns := []honeycombio.Column{
{
KeyName: acctest.RandString(4) + "_test_column3",
Description: "test column3",
Type: honeycombio.ToPtr(honeycombio.ColumnType("float")),
},
}

for i, column := range testColumns {
col, err := c.Columns.Create(ctx, dataset, &column)
require.NoError(t, err)
// update ID for removal later
testColumns[i].ID = col.ID

}
//nolint:errcheck
col, err := c.Columns.Create(ctx, dataset, &honeycombio.Column{
KeyName: test.RandomStringWithPrefix("test.", 10),
Description: test.RandomString(20),
Type: honeycombio.ToPtr(honeycombio.ColumnTypeFloat),
})
require.NoError(t, err)
t.Cleanup(func() {
// remove Columns at the of the test run
for _, col := range testColumns {
c.Columns.Delete(ctx, dataset, col.ID)
}
c.Columns.Delete(ctx, dataset, col.ID)
})

resource.Test(t, resource.TestCase{
PreCheck: testAccPreCheck(t),
ProtoV5ProviderFactories: testAccProtoV5ProviderFactory,
Steps: []resource.TestStep{
// match by name and return a single column with the right type
{
Config: testAccDataSourceColumnConfig([]string{"dataset = \"" + testAccDataset() + "\"", "name = \"" + testColumns[0].KeyName + "\""}),
Check: resource.TestCheckResourceAttr("data.honeycombio_column.test", "type", "float"),
},
// test a failed match
{
Config: testAccDataSourceColumnConfig([]string{"dataset = \"" + testAccDataset() + "\"", "name = \"test_column5\""}),
ExpectError: regexp.MustCompile("404 Not Found"),
Config: fmt.Sprintf(`
data "honeycombio_column" "test" {
dataset = "%s"
name = "%s"
}`, dataset, col.KeyName),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("data.honeycombio_column.test", "name", col.KeyName),
resource.TestCheckResourceAttr("data.honeycombio_column.test", "description", col.Description),
resource.TestCheckResourceAttr("data.honeycombio_column.test", "type", "float"),
resource.TestCheckResourceAttr("data.honeycombio_column.test", "hidden", "false"),
resource.TestCheckResourceAttrSet("data.honeycombio_column.test", "last_written_at"),
resource.TestCheckResourceAttrSet("data.honeycombio_column.test", "created_at"),
resource.TestCheckResourceAttrSet("data.honeycombio_column.test", "updated_at"),
),
PlanOnly: true,
},
},
})
}

func testAccDataSourceColumnConfig(filters []string) string {
return fmt.Sprintf(`
resource.Test(t, resource.TestCase{
PreCheck: testAccPreCheck(t),
ProtoV5ProviderFactories: testAccProtoV5ProviderFactory,
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(`
data "honeycombio_column" "test" {
%s
}
output "type" {
value = data.honeycombio_column.test.type
}
output "description" {
value = data.honeycombio_column.test.description
}
`, strings.Join(filters, "\n"))
dataset = "%s"
name = "does-not-exist"
}`, dataset),
PlanOnly: true,
ExpectError: regexp.MustCompile(`(?i)not found`),
},
},
})
}
Loading

0 comments on commit 78a9008

Please sign in to comment.