Skip to content

Commit

Permalink
add pre-check to exclude expensive tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skyscrapr committed Jun 22, 2023
1 parent 08e5e92 commit fef0341
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion openai/finetune_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func TestAccFineTuneResource(t *testing.T) {
t.Skip("Cost associated with test")
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() { testAccOpenAI(t); testAccPreCheck(t) },
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
// Create and Read testing
Expand Down
8 changes: 8 additions & 0 deletions openai/provider_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package openai

import (
"os"
"testing"

"github.com/hashicorp/terraform-plugin-framework/providerserver"
Expand All @@ -20,3 +21,10 @@ func testAccPreCheck(t *testing.T) {
// about the appropriate environment variables being set are common to see in a pre-check
// function.
}

func testAccOpenAI(t *testing.T) {
// Use this to skip tests that might take a long time or cost too much
if os.Getenv("TF_ACC_OPENAI") != "" {
t.Skipf("env var TF_ACC_OPENAI not set. Skipping acceptance test")
}
}

0 comments on commit fef0341

Please sign in to comment.