-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
…tests Feat/integration tests
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
COMMERCELAYER_CLIENT_ID=<commercelayer-client-id> | ||
COMMERCELAYER_CLIENT_SECRET=<commercelayer-client-secret> | ||
COMMERCELAYER_API_ENDPOINT=<commercelayer-api-endpoint> | ||
COMMERCELAYER_AUTH_ENDPOINT=<commercelayer-auth-endpoint> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,84 @@ | ||
/.DS_Store | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# AWS User-specific | ||
.idea/**/aws.xml | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/artifacts | ||
# .idea/compiler.xml | ||
# .idea/jarRepositories.xml | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
# *.iml | ||
# *.ipr | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# SonarLint plugin | ||
.idea/sonarlint/ | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Project | ||
/terraform-provider-commercelayer | ||
/examples/**/*.tfstate* | ||
/examples/**/*.tfvars | ||
/bin | ||
/dist/ | ||
/examples/**/*.lock.hcl | ||
/examples/**/.terraform | ||
/bin/ | ||
/dist/ | ||
/.env |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package commercelayer | ||
|
||
import ( | ||
"bytes" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
"log" | ||
"os" | ||
"testing" | ||
"text/template" | ||
) | ||
|
||
func init() { | ||
testAccProviderCommercelayer = Provider() | ||
testAccProviderFactories = map[string]func() (*schema.Provider, error){ | ||
"commercelayer": func() (*schema.Provider, error) { | ||
return testAccProviderCommercelayer, nil | ||
}, | ||
} | ||
} | ||
|
||
var testAccProviderCommercelayer *schema.Provider | ||
var testAccProviderFactories = map[string]func() (*schema.Provider, error){} | ||
|
||
func TestProvider(t *testing.T) { | ||
provider := Provider() | ||
if err := provider.InternalValidate(); err != nil { | ||
t.Fatalf("err: %s", err) | ||
} | ||
} | ||
|
||
func testAccPreCheck(t *testing.T) { | ||
requiredEnvs := []string{ | ||
"COMMERCELAYER_CLIENT_ID", | ||
"COMMERCELAYER_CLIENT_SECRET", | ||
"COMMERCELAYER_API_ENDPOINT", | ||
"COMMERCELAYER_AUTH_ENDPOINT", | ||
} | ||
for _, val := range requiredEnvs { | ||
if os.Getenv(val) == "" { | ||
t.Fatalf("%v must be set for acceptance tests", val) | ||
} | ||
} | ||
} | ||
|
||
func hclTemplate(data string, params map[string]any) string { | ||
var out bytes.Buffer | ||
tmpl := template.Must(template.New("hcl").Parse(data)) | ||
err := tmpl.Execute(&out, params) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
return out.String() | ||
} |