Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the test suite run on windows #108

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.terraform
plan.tfplan
terraform.tfstate.backup

# IntelliJ IDE files
.idea/
3 changes: 2 additions & 1 deletion config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ package tfjson
import (
"encoding/json"
"os"
"path/filepath"
"testing"
)

func TestConfigValidate(t *testing.T) {
f, err := os.Open("testdata/basic/plan.json")
f, err := os.Open(filepath.FromSlash("testdata/basic/plan.json"))
if err != nil {
t.Fatal(err)
}
Expand Down
3 changes: 2 additions & 1 deletion metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ package tfjson
import (
"encoding/json"
"os"
"path/filepath"
"testing"
)

func TestMetadataFunctionsValidate(t *testing.T) {
f, err := os.Open("testdata/basic/functions.json")
f, err := os.Open(filepath.FromSlash("testdata/basic/functions.json"))
if err != nil {
t.Fatal(err)
}
Expand Down
9 changes: 5 additions & 4 deletions plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ package tfjson
import (
"encoding/json"
"os"
"path/filepath"
"reflect"
"testing"

"github.com/google/go-cmp/cmp"
)

func TestPlanValidate(t *testing.T) {
f, err := os.Open("testdata/basic/plan.json")
f, err := os.Open(filepath.FromSlash("testdata/basic/plan.json"))
if err != nil {
t.Fatal(err)
}
Expand All @@ -30,7 +31,7 @@ func TestPlanValidate(t *testing.T) {
}

func TestPlan_015(t *testing.T) {
f, err := os.Open("testdata/basic/plan-0.15.json")
f, err := os.Open(filepath.FromSlash("testdata/basic/plan-0.15.json"))
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -68,7 +69,7 @@ func TestPlan_015(t *testing.T) {
}

func TestPlan_withChecks(t *testing.T) {
f, err := os.Open("testdata/has_checks/plan.json")
f, err := os.Open(filepath.FromSlash("testdata/has_checks/plan.json"))
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -101,7 +102,7 @@ func TestPlan_withChecks(t *testing.T) {
}

func TestPlan_movedBlock(t *testing.T) {
f, err := os.Open("testdata/moved_block/plan.json")
f, err := os.Open(filepath.FromSlash("testdata/moved_block/plan.json"))
if err != nil {
t.Fatal(err)
}
Expand Down
5 changes: 3 additions & 2 deletions schemas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ package tfjson
import (
"encoding/json"
"os"
"path/filepath"
"testing"
)

func TestProviderSchemasValidate(t *testing.T) {
f, err := os.Open("testdata/basic/schemas.json")
f, err := os.Open(filepath.FromSlash("testdata/basic/schemas.json"))
if err != nil {
t.Fatal(err)
}
Expand All @@ -27,7 +28,7 @@ func TestProviderSchemasValidate(t *testing.T) {
}

func TestProviderSchemasValidate_nestedAttributes(t *testing.T) {
f, err := os.Open("testdata/nested_attributes/schemas.json")
f, err := os.Open(filepath.FromSlash("testdata/nested_attributes/schemas.json"))
if err != nil {
t.Fatal(err)
}
Expand Down
11 changes: 6 additions & 5 deletions state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"testing"
)

func TestStateValidate_raw(t *testing.T) {
f, err := os.Open("testdata/no_changes/state.json")
f, err := os.Open(filepath.FromSlash("testdata/no_changes/state.json"))
if err != nil {
t.Fatal(err)
}
Expand All @@ -28,7 +29,7 @@ func TestStateValidate_raw(t *testing.T) {
}

func TestStateUnmarshal_valid(t *testing.T) {
f, err := os.Open("testdata/no_changes/state.json")
f, err := os.Open(filepath.FromSlash("testdata/no_changes/state.json"))
if err != nil {
t.Fatal(err)
}
Expand All @@ -47,7 +48,7 @@ func TestStateUnmarshal_valid(t *testing.T) {
}

func TestStateUnmarshal_internalState(t *testing.T) {
f, err := os.Open("testdata/no_changes/terraform.tfstate")
f, err := os.Open(filepath.FromSlash("testdata/no_changes/terraform.tfstate"))
if err != nil {
t.Fatal(err)
}
Expand All @@ -71,7 +72,7 @@ func TestStateUnmarshal_internalState(t *testing.T) {
}

func TestStateValidate_fromPlan(t *testing.T) {
f, err := os.Open("testdata/no_changes/plan.json")
f, err := os.Open(filepath.FromSlash("testdata/no_changes/plan.json"))
if err != nil {
t.Fatal(err)
}
Expand All @@ -88,7 +89,7 @@ func TestStateValidate_fromPlan(t *testing.T) {
}

func TestStateValidate_fromPlan110(t *testing.T) {
f, err := os.Open("testdata/110_basic/plan.json")
f, err := os.Open(filepath.FromSlash("testdata/110_basic/plan.json"))
if err != nil {
t.Fatal(err)
}
Expand Down