Skip to content

Commit 15a582b

Browse files
committed
Update integration test to check for UNSTRUCTURED_API_KEY environment variable
- Added a conditional skip for the TestWorkflow function if the UNSTRUCTURED_API_KEY is not set.
1 parent a735839 commit 15a582b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

test/main_test.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build integration
2+
13
package test
24

35
import (
@@ -14,7 +16,10 @@ import (
1416
)
1517

1618
func TestWorkflow(t *testing.T) {
17-
t.Skip()
19+
key := os.Getenv("UNSTRUCTURED_API_KEY")
20+
if key == "" {
21+
t.Skip("skipping because UNSTRUCTURED_API_KEY is not set")
22+
}
1823

1924
pretty := func(v any) string {
2025
data, err := json.MarshalIndent(v, "", " ")
@@ -26,13 +31,7 @@ func TestWorkflow(t *testing.T) {
2631
}
2732

2833
client, err := unstructured.New(
29-
// unstructured.WithClient(&http.Client{
30-
// Transport: &teert{
31-
// next: http.DefaultTransport,
32-
// dst: t.Output(),
33-
// },
34-
// }),
35-
unstructured.WithKey(os.Getenv("UNSTRUCTURED_API_KEY")),
34+
unstructured.WithKey(key),
3635
)
3736
if err != nil {
3837
t.Fatalf("failed to create client: %v", err)
@@ -57,7 +56,7 @@ func TestWorkflow(t *testing.T) {
5756

5857
t.Cleanup(func() { _ = client.DeleteWorkflow(ctx, workflow.ID) })
5958

60-
// get all the dir under ./testdata and use them in a call to run the workflow.
59+
// get all the files under ./testdata and use them in a call to run the workflow.
6160
dir, err := os.ReadDir("testdata")
6261
if err != nil {
6362
t.Fatalf("failed to read testdata: %v", err)

0 commit comments

Comments
 (0)