Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore!: Move from TestMain to Test Suites #695

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
strategy:
fail-fast: false
matrix:
parallel: [ 15 ]
index: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ]
parallel: [ 3 ]
index: [ 0, 1, 2 ]

steps:
- uses: actions/checkout@v3
Expand Down 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 standard-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 All @@ -97,6 +97,7 @@ jobs:
OCTOTESTVERSION: latest
OCTOTESTIMAGEURL: docker.packages.octopushq.com/octopusdeploy/octopusdeploy
OCTOTESTRETRYCOUNT: 1
TF_ACC: 1
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -128,18 +129,6 @@ jobs:
"junit-test-summary-0/*.xml"
"junit-test-summary-1/*.xml"
"junit-test-summary-2/*.xml"
"junit-test-summary-3/*.xml"
"junit-test-summary-4/*.xml"
"junit-test-summary-5/*.xml"
"junit-test-summary-6/*.xml"
"junit-test-summary-7/*.xml"
"junit-test-summary-8/*.xml"
"junit-test-summary-9/*.xml"
"junit-test-summary-10/*.xml"
"junit-test-summary-11/*.xml"
"junit-test-summary-12/*.xml"
"junit-test-summary-13/*.xml"
"junit-test-summary-14/*.xml"

- name: Upload test artifacts
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21

require (
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.49.1
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20240725054341-2848f54d101e
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20240729041805-46db6fb717b4
github.com/google/uuid v1.6.0
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637
github.com/hashicorp/terraform-plugin-docs v0.13.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ github.com/OctopusDeploy/go-octopusdeploy/v2 v2.49.1 h1:lzC3tcnfvC07Ilqn5J51qhOn
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.49.1/go.mod h1:ggvOXzMnq+w0pLg6C9zdjz6YBaHfO3B3tqmmB7JQdaw=
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20240725054341-2848f54d101e h1:FIvWa8wNg8IBG5uVhqkKvcBhaxx4TgN7T8/5Ed4VQUE=
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20240725054341-2848f54d101e/go.mod h1:Oq9KbiRNDBB5jFmrwnrgLX0urIqR/1ptY18TzkqXm7M=
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20240729041805-46db6fb717b4 h1:QfbVf0bOIRMp/WHAWsuVDB7KHoWnRsGbvDuOf2ua7k4=
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20240729041805-46db6fb717b4/go.mod h1:Oq9KbiRNDBB5jFmrwnrgLX0urIqR/1ptY18TzkqXm7M=
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97LyUpzH9P6Hrlg=
github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
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
Loading
Loading