Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #188 from hashicorp/e2e-refactor-utils
Refactor enterprise e2e test utilities
- Loading branch information
Showing
5 changed files
with
177 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//go:build e2e && enterprise | ||
// +build e2e,enterprise | ||
|
||
package e2e | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
func (c hclConfig) appendTerraformCloudBlock(hostname string, org string, token string, opts ...string) hclConfig { | ||
var optsConfig string | ||
if len(opts) > 0 { | ||
optsConfig = "\n" + strings.Join(opts, "\n") | ||
} | ||
|
||
return c.appendString(fmt.Sprintf(` | ||
driver "terraform-cloud" { | ||
hostname = "%s" | ||
organization = "%s" | ||
token = "%s" | ||
%s | ||
}`, hostname, org, token, optsConfig)) | ||
} | ||
|
||
func (c hclConfig) appendModuleTask(name string, source string, opts ...string) hclConfig { | ||
return c.appendString(moduleTaskConfig(name, source, opts...)) | ||
} | ||
|
||
func moduleTaskConfig(name string, source string, opts ...string) string { | ||
var optsConfig string | ||
if len(opts) > 0 { | ||
optsConfig = "\n" + strings.Join(opts, "\n") | ||
} | ||
|
||
return fmt.Sprintf(` | ||
task { | ||
name = "%s" | ||
description = "e2e test" | ||
services = ["api", "web"] | ||
source = "%s" | ||
%s | ||
} | ||
`, name, source, optsConfig) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.