Skip to content

Commit

Permalink
PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomper-TE committed Dec 13, 2023
1 parent 8aead26 commit 87aad1f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.20
require (
github.com/hashicorp/terraform-plugin-docs v0.9.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.30.0
github.com/stretchr/testify v1.8.4
github.com/thousandeyes/thousandeyes-sdk-go/v2 v2.4.1
)

Expand All @@ -18,6 +19,7 @@ require (
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.6.0 // indirect
Expand Down Expand Up @@ -53,12 +55,12 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/posener/complete v1.2.3 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/russross/blackfriday v1.6.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/stretchr/testify v1.8.3 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
Expand All @@ -73,4 +75,5 @@ require (
google.golang.org/grpc v1.57.1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/thousandeyes/thousandeyes-sdk-go/v2 v2.4.1 h1:UQi0ITz+oQebqr5CGQ4owN//3izmW4C7ed/NQVzLzIg=
github.com/thousandeyes/thousandeyes-sdk-go/v2 v2.4.1/go.mod h1:XQouPCy3dIp81Xzkp9bqu6vg7fmE4QQpA6REsLVTDdE=
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
Expand Down
21 changes: 6 additions & 15 deletions thousandeyes/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ package thousandeyes
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/stretchr/testify/require"
"github.com/thousandeyes/thousandeyes-sdk-go/v2"
"os"
"strconv"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

type ResourceType struct {
Expand All @@ -32,24 +31,16 @@ func init() {
func testAccPreCheck(t *testing.T) {
providerFunc, _ := providerFactories["thousandeyes"]
provider, err := providerFunc()
if err != nil {
fmt.Printf("Error creating provider: %v", err)
os.Exit(1)
}
require.Nil(t, err, "Error creating provider: %v", err)

ctx := context.TODO()
resourceData := schema.TestResourceDataRaw(t, provider.Schema, map[string]interface{}{})
testClientRaw, diags := provider.ConfigureContextFunc(ctx, resourceData)
if diags != nil && diags.HasError() {
fmt.Printf("Error configuring client: %v", diags)
os.Exit(1)
}

require.False(t, diags != nil && diags.HasError(), "Error configuring client: %v", diags)

testClient = testClientRaw.(*thousandeyes.Client)
if testClient == nil {
fmt.Printf("Error converting client: unexpected type")
os.Exit(1)
}
require.NotNil(t, testClient, "Error converting client: unexpected type")
}

func testAccCheckResourceDestroy(resources []ResourceType, s *terraform.State) error {
Expand Down

0 comments on commit 87aad1f

Please sign in to comment.