github.com/opentofu/opentofu@v1.7.1/internal/cloud/e2e/init_with_empty_tags_test.go (about)

     1  // Copyright (c) The OpenTofu Authors
     2  // SPDX-License-Identifier: MPL-2.0
     3  // Copyright (c) 2023 HashiCorp, Inc.
     4  // SPDX-License-Identifier: MPL-2.0
     5  
     6  package main
     7  
     8  import (
     9  	"testing"
    10  )
    11  
    12  func Test_init_with_empty_tags(t *testing.T) {
    13  	t.Parallel()
    14  	skipIfMissingEnvVar(t)
    15  	skipWithoutRemoteTerraformVersion(t)
    16  
    17  	cases := testCases{
    18  		"terraform init with cloud block - no tagged workspaces exist yet": {
    19  			operations: []operationSets{
    20  				{
    21  					prep: func(t *testing.T, orgName, dir string) {
    22  						wsTag := "emptytag"
    23  						tfBlock := terraformConfigCloudBackendTags(orgName, wsTag)
    24  						writeMainTF(t, tfBlock, dir)
    25  					},
    26  					commands: []tfCommand{
    27  						{
    28  							command:           []string{"init"},
    29  							expectedCmdOutput: `There are no workspaces with the configured tags`,
    30  							userInput:         []string{"emptytag-prod"},
    31  							postInputOutput:   []string{`Terraform Cloud has been successfully initialized!`},
    32  						},
    33  					},
    34  				},
    35  			},
    36  		},
    37  	}
    38  
    39  	testRunner(t, cases, 1)
    40  }