Skip to content

Commit

Permalink
Merge branch 'main' into feature/upgrade-go-to-1-22
Browse files Browse the repository at this point in the history
  • Loading branch information
ekampf authored Feb 26, 2024
2 parents ca05384 + f655814 commit 8488ef3
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ jobs:
fail-fast: false
matrix:
terraform:
- '1.4.*'
- '1.5.*'
- '1.6.*'
- '1.7.*'
- 'latest'
steps:

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/smoketests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ permissions: read-all
on:
schedule:
- cron: "0 */3 * * *"
workflow_dispatch: {}

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
github.com/hashicorp/terraform-plugin-go v0.21.0
github.com/hashicorp/terraform-plugin-testing v1.6.0
github.com/hasura/go-graphql-client v0.11.0
github.com/hasura/go-graphql-client v0.12.0
github.com/iancoleman/strcase v0.3.0
github.com/jarcoal/httpmock v1.3.1
github.com/mattn/goveralls v0.0.12
Expand Down
10 changes: 2 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/graph-gophers/graphql-go v1.5.0 h1:fDqblo50TEpD0LY7RXk/LFVYEVqo3+tXMNMPSVXA1yc=
github.com/graph-gophers/graphql-go v1.5.0/go.mod h1:YtmJZDLbF1YYNrlNAuiO5zAStUWc3XZT07iGsVqe1Os=
github.com/graph-gophers/graphql-transport-ws v0.0.2 h1:DbmSkbIGzj8SvHei6n8Mh9eLQin8PtA8xY9eCzjRpvo=
github.com/graph-gophers/graphql-transport-ws v0.0.2/go.mod h1:5BVKvFzOd2BalVIBFfnfmHjpJi/MZ5rOj8G55mXvZ8g=
github.com/hashicorp/cli v1.1.6 h1:CMOV+/LJfL1tXCOKrgAX0uRKnzjj/mpmqNXloRSy2K8=
github.com/hashicorp/cli v1.1.6/go.mod h1:MPon5QYlgjjo0BSoAiN0ESeT5fRzDjVRp+uioJ0piz4=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
Expand Down Expand Up @@ -146,8 +140,8 @@ github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S
github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc=
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
github.com/hasura/go-graphql-client v0.11.0 h1:EFEkpMZlkq5gLZj9oiI6TnHCOHV1oErxOroMc5qUHQI=
github.com/hasura/go-graphql-client v0.11.0/go.mod h1:eNNnmHAp6NgwKZ4xRbZEfywxr07qk34Y0QhbPsYIfhw=
github.com/hasura/go-graphql-client v0.12.0 h1:mVVPIP87sVFXaPIBL07AhTjOEvgXnNSIHJ3qKcWUFkQ=
github.com/hasura/go-graphql-client v0.12.0/go.mod h1:F4N4kR6vY8amio3gEu3tjSZr8GPOXJr3zj72DKixfLE=
github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4=
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ func TestAccDatasourceTwingateConnectorsFilterBySuffix(t *testing.T) {
t.Parallel()

connectorName := test.RandomConnectorName()
prefix := test.Prefix()
suffix := connectorName[len(prefix):]
resourceName := test.RandomResourceName()
theDatasource := "data.twingate_connectors." + resourceName

Expand All @@ -273,7 +271,7 @@ func TestAccDatasourceTwingateConnectorsFilterBySuffix(t *testing.T) {
CheckDestroy: acctests.CheckTwingateResourceDestroy,
Steps: []resource.TestStep{
{
Config: testDatasourceTwingateConnectorsFilter(resourceName, test.RandomName(), connectorName, attr.FilterBySuffix, suffix),
Config: testDatasourceTwingateConnectorsFilter(resourceName, test.RandomName(), connectorName, attr.FilterBySuffix, connectorName),
Check: acctests.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(theDatasource, connectorsLen, "1"),
resource.TestCheckResourceAttr(theDatasource, connectorNamePath, connectorName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,15 @@ func TestAccDatasourceTwingateServicesFilterByPrefix(t *testing.T) {
theDatasource = "data.twingate_service_accounts.out"
)

prefix := test.Prefix("orange")
prefix := test.Prefix("orange") + acctest.RandString(5)
name := acctest.RandomWithPrefix(prefix)
config := []terraformServiceConfig{
{
serviceName: name,
terraformResourceName: test.TerraformRandName(terraformResourceName),
},
{
serviceName: test.Prefix("lemon"),
serviceName: test.Prefix("lemon") + acctest.RandString(5),
terraformResourceName: test.TerraformRandName(terraformResourceName),
},
}
Expand Down
4 changes: 2 additions & 2 deletions twingate/internal/test/acctests/datasource/users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import (

func TestAccDatasourceTwingateUsers_basic(t *testing.T) {
t.Run("Test Twingate Datasource : Acc Users Basic", func(t *testing.T) {
acctests.SetPageLimit(1)

users, err := acctests.GetTestUsers()
if err != nil && !errors.Is(err, acctests.ErrResourceNotFound) {
t.Skip("can't run test:", err)
}

acctests.SetPageLimit(len(users)/3 + 1)

resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: acctests.ProviderFactories,
PreCheck: func() { acctests.PreCheck(t) },
Expand Down
4 changes: 1 addition & 3 deletions twingate/internal/test/acctests/resource/connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import (
"github.com/hashicorp/terraform-plugin-testing/terraform"
)

var testRegexp = regexp.MustCompile(test.Prefix() + ".*")

func TestAccRemoteConnectorCreate(t *testing.T) {
t.Run("Test Twingate Resource : Acc Remote Connector", func(t *testing.T) {
const terraformResourceName = "test_c1"
Expand Down Expand Up @@ -78,7 +76,7 @@ func TestAccRemoteConnectorImport(t *testing.T) {
Config: terraformResourceTwingateConnectorWithName(terraformResourceName, remoteNetworkName, connectorName),
Check: acctests.ComposeTestCheckFunc(
checkTwingateConnectorSetWithRemoteNetwork(theResource, acctests.TerraformRemoteNetwork(terraformResourceName)),
sdk.TestMatchResourceAttr(theResource, attr.Name, testRegexp),
sdk.TestMatchResourceAttr(theResource, attr.Name, regexp.MustCompile(connectorName[:len(connectorName)-3]+".*")),
),
},
{
Expand Down
9 changes: 5 additions & 4 deletions twingate/internal/test/helper.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package test

import (
"crypto/sha256"
"fmt"
"os"
"strings"
Expand All @@ -17,10 +18,10 @@ const (
func RandomConnectorName() string {
const maxLength = 30

name := Prefix(acctest.RandString(maxLength))
if len(name) > maxLength {
name = name[:maxLength]
}
// hash using only for text compression
hash := fmt.Sprintf("%x", sha256.Sum224([]byte(Prefix())))
name := fmt.Sprintf("%s-%s-", prefixName, hash[:15])
name += acctest.RandString(maxLength - len(name))

return name
}
Expand Down

0 comments on commit 8488ef3

Please sign in to comment.