Skip to content

Commit

Permalink
Move to test suites
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacCalligeros95 committed Jul 29, 2024
1 parent e4f0093 commit 03423ed
Show file tree
Hide file tree
Showing 87 changed files with 485 additions and 465 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
- name: Test
run: |
GOBIN=$PWD/bin go install gotest.tools/gotestsum@latest
./bin/gotestsum --junitfile node-summary.xml --format short-verbose -- -run "${{ steps.test_split.outputs.run }}" -timeout 0 ./... -createSharedContainer=true
./bin/gotestsum --junitfile node-summary.xml --format short-verbose -- -run "${{ steps.test_split.outputs.run }}" -timeout 0 ./...
shell: bash
env:
LICENSE: ${{ secrets.OCTOPUS_SERVER_BASE64_LICENSE }}
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/OctopusDeploy/terraform-provider-octopusdeploy

go 1.21

replace github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework => C:\Users\isaac\source\repos\OctopusTerraformTestFramework

require (
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.43.0
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20240725030800-42853d105802
Expand Down
8 changes: 3 additions & 5 deletions octopusdeploy/data_source_accounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ package octopusdeploy

import (
"fmt"
"testing"

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

func TestAccDataSourceAccounts(t *testing.T) {
func (suite *IntegrationTestSuite) TestAccDataSourceAccounts() {
localName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
name := fmt.Sprintf("data.octopusdeploy_accounts.%s", localName)
take := 10

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
resource.Test(suite.T(), resource.TestCase{
PreCheck: func() { testAccPreCheck(suite.T()) },
ProtoV6ProviderFactories: ProtoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Expand Down
8 changes: 3 additions & 5 deletions octopusdeploy/data_source_channels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ package octopusdeploy

import (
"fmt"
"testing"

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

func TestAccDataSourceChannels(t *testing.T) {
func (suite *IntegrationTestSuite) TestAccDataSourceChannels() {
localName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
name := fmt.Sprintf("data.octopusdeploy_channels.%s", localName)
take := 10

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
resource.Test(suite.T(), resource.TestCase{
PreCheck: func() { testAccPreCheck(suite.T()) },
ProtoV6ProviderFactories: ProtoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Expand Down
8 changes: 3 additions & 5 deletions octopusdeploy/data_source_projects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ package octopusdeploy

import (
"fmt"
"testing"

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

func TestAccDataSourceProjects(t *testing.T) {
func (suite *IntegrationTestSuite) TestAccDataSourceProjects() {
localName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
name := fmt.Sprintf("data.octopusdeploy_projects.%s", localName)
take := 10

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
resource.Test(suite.T(), resource.TestCase{
PreCheck: func() { testAccPreCheck(suite.T()) },
ProtoV6ProviderFactories: ProtoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Expand Down
8 changes: 3 additions & 5 deletions octopusdeploy/data_source_script_modules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ package octopusdeploy

import (
"fmt"
"testing"

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

func TestAccDataSourceScriptModules(t *testing.T) {
func (suite *IntegrationTestSuite) TestAccDataSourceScriptModules() {
localName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
name := fmt.Sprintf("data.octopusdeploy_script_modules.%s", localName)
take := 10

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
resource.Test(suite.T(), resource.TestCase{
PreCheck: func() { testAccPreCheck(suite.T()) },
ProtoV6ProviderFactories: ProtoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Expand Down
8 changes: 3 additions & 5 deletions octopusdeploy/data_source_spaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ package octopusdeploy

import (
"fmt"
"testing"

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

func TestAccDataSourceSpaces(t *testing.T) {
func (suite *IntegrationTestSuite) TestAccDataSourceSpaces() {
localName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
name := fmt.Sprintf("data.octopusdeploy_spaces.%s", localName)
take := 10

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
resource.Test(suite.T(), resource.TestCase{
PreCheck: func() { testAccPreCheck(suite.T()) },
ProtoV6ProviderFactories: ProtoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Expand Down
8 changes: 3 additions & 5 deletions octopusdeploy/data_source_tag_sets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ package octopusdeploy

import (
"fmt"
"testing"

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

func TestAccDataSourceTagSets(t *testing.T) {
func (suite *IntegrationTestSuite) TestAccDataSourceTagSets() {
localName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
name := fmt.Sprintf("data.octopusdeploy_tag_sets.%s", localName)
take := 10

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
resource.Test(suite.T(), resource.TestCase{
PreCheck: func() { testAccPreCheck(suite.T()) },
ProtoV6ProviderFactories: ProtoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Expand Down
10 changes: 4 additions & 6 deletions octopusdeploy/data_source_tenants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@ package octopusdeploy

import (
"fmt"
"strconv"
"testing"

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

func TestAccDataSourceTenants(t *testing.T) {
func (suite *IntegrationTestSuite) TestAccDataSourceTenants() {
localName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
name := fmt.Sprintf("data.octopusdeploy_tenants.%s", localName)
skip := acctest.RandIntRange(0, 100)
take := acctest.RandIntRange(0, 100)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
resource.Test(suite.T(), resource.TestCase{
PreCheck: func() { testAccPreCheck(suite.T()) },
ProtoV6ProviderFactories: ProtoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Expand Down
8 changes: 3 additions & 5 deletions octopusdeploy/data_source_users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ package octopusdeploy

import (
"fmt"
"testing"

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

func TestAccDataSourceUsers(t *testing.T) {
func (suite *IntegrationTestSuite) TestAccDataSourceUsers() {
localName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
name := fmt.Sprintf("data.octopusdeploy_users.%s", localName)
username := "d"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
resource.Test(suite.T(), resource.TestCase{
PreCheck: func() { testAccPreCheck(suite.T()) },
ProtoV6ProviderFactories: ProtoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Expand Down
8 changes: 3 additions & 5 deletions octopusdeploy/data_source_worker_pools_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ package octopusdeploy

import (
"fmt"
"testing"

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

func TestAccDataSourceWorkerPools(t *testing.T) {
func (suite *IntegrationTestSuite) TestAccDataSourceWorkerPools() {
localName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
name := fmt.Sprintf("data.octopusdeploy_worker_pools.%s", localName)
partialName := "W"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
resource.Test(suite.T(), resource.TestCase{
PreCheck: func() { testAccPreCheck(suite.T()) },
ProtoV6ProviderFactories: ProtoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Expand Down
4 changes: 2 additions & 2 deletions octopusdeploy/resource_aws_account_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework/octoclient"
"github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework/test"
"path/filepath"
"testing"
)

// TestAwsAccountExport verifies that an AWS account can be reimported with the correct settings
func TestAwsAccountExport(t *testing.T) {
func (suite *IntegrationTestSuite) TestAwsAccountExport() {
testFramework := test.OctopusContainerTest{}

t := suite.T()
newSpaceId, err := testFramework.Act(t, octoContainer, "../terraform", "3-awsaccount", []string{})

if err != nil {
Expand Down
10 changes: 4 additions & 6 deletions octopusdeploy/resource_aws_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ package octopusdeploy

import (
"fmt"
"testing"

"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccAWSAccountBasic(t *testing.T) {
func (suite *IntegrationTestSuite) TestAccAWSAccountBasic() {
localName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
prefix := "octopusdeploy_aws_account." + localName

Expand All @@ -21,9 +19,9 @@ func TestAccAWSAccountBasic(t *testing.T) {

newAccessKey := acctest.RandString(acctest.RandIntRange(20, 3000))

resource.Test(t, resource.TestCase{
CheckDestroy: testAccountCheckDestroy,
PreCheck: func() { testAccPreCheck(t) },
resource.Test(suite.T(), resource.TestCase{
CheckDestroy: testAccountCheckDestroy,
PreCheck: func() { testAccPreCheck(suite.T()) },
ProtoV6ProviderFactories: ProtoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Expand Down
12 changes: 5 additions & 7 deletions octopusdeploy/resource_aws_openid_connect_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ package octopusdeploy

import (
"fmt"
"strings"
"testing"

"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"strings"
)

func TestAccAWSOIDCAccountBasic(t *testing.T) {
SkipCI(t, "Session Duration conversion in the schema is handled incorrectly")
func (suite *IntegrationTestSuite) TestAccAWSOIDCAccountBasic() {
SkipCI(suite.T(), "Session Duration conversion in the schema is handled incorrectly")
localName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
prefix := "octopusdeploy_aws_account." + localName

Expand All @@ -25,9 +23,9 @@ func TestAccAWSOIDCAccountBasic(t *testing.T) {
healthKeys := []string{"target"}
accountKeys := []string{"type"}

resource.Test(t, resource.TestCase{
resource.Test(suite.T(), resource.TestCase{
CheckDestroy: testAccountCheckDestroy,
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() { testAccPreCheck(suite.T()) },
ProtoV6ProviderFactories: ProtoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import (
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/machines"
"github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework/octoclient"
"github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework/test"
"testing"
)

// TestAzureCloudServiceTargetResource verifies that a azure cloud service target can be reimported with the correct settings
func TestAzureCloudServiceTargetResource(t *testing.T) {
func (suite *IntegrationTestSuite) TestAzureCloudServiceTargetResource() {
// I could not figure out a combination of properties that made the octopusdeploy_azure_subscription_account resource work
return

t := suite.T()
testFramework := test.OctopusContainerTest{}

newSpaceId, err := testFramework.Act(t, octoContainer, "../terraform", "35-azurecloudservicetarget", []string{})
newSpaceId, err := testFramework.Act(suite.T(), octoContainer, "../terraform", "35-azurecloudservicetarget", []string{})

if err != nil {
t.Fatal(err.Error())
suite.T().Fatal(err.Error())
}

// Assert
Expand Down
10 changes: 4 additions & 6 deletions octopusdeploy/resource_azure_oidc_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ package octopusdeploy

import (
"fmt"
"testing"

"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/core"
uuid "github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccOctopusDeployAzureOpenIDConnectAccountBasic(t *testing.T) {
SkipCI(t, "audience is not set on initial creation")
func (suite *IntegrationTestSuite) TestAccOctopusDeployAzureOpenIDConnectAccountBasic() {
SkipCI(suite.T(), "audience is not set on initial creation")
localName := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)
prefix := "octopusdeploy_azure_openid_connect." + localName

Expand All @@ -29,9 +27,9 @@ func TestAccOctopusDeployAzureOpenIDConnectAccountBasic(t *testing.T) {

newDescription := acctest.RandStringFromCharSet(20, acctest.CharSetAlpha)

resource.Test(t, resource.TestCase{
resource.Test(suite.T(), resource.TestCase{
CheckDestroy: testAccountCheckDestroy,
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() { testAccPreCheck(suite.T()) },
ProtoV6ProviderFactories: ProtoV6ProviderFactories(),
Steps: []resource.TestStep{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework/octoclient"
"github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework/test"
"path/filepath"
"testing"
)

// TestAzureServiceFabricTargetResource verifies that a service fabric target can be reimported with the correct settings
func TestAzureServiceFabricTargetResource(t *testing.T) {
func (suite *IntegrationTestSuite) TestAzureServiceFabricTargetResource() {
testFramework := test.OctopusContainerTest{}
t := suite.T()

newSpaceId, err := testFramework.Act(t, octoContainer, "../terraform", "36-servicefabrictarget", []string{
"-var=target_service_fabric=whatever",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/accounts"
"github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework/octoclient"
"github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework/test"
"testing"
)

// TestAzureAccountResource verifies that an Azure account can be reimported with the correct settings
func TestAzureAccountResource(t *testing.T) {
func (suite *IntegrationTestSuite) TestAzureAccountResource() {
testFramework := test.OctopusContainerTest{}
t := suite.T()

newSpaceId, err := testFramework.Act(t, octoContainer, "../terraform", "4-azureaccount", []string{})

Expand Down
Loading

0 comments on commit 03423ed

Please sign in to comment.