-
Notifications
You must be signed in to change notification settings - Fork 23
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 #37 from carolynvs/fix-schema
Fix schema command
- Loading branch information
Showing
9 changed files
with
61 additions
and
187 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
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
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//go:generate packr2 | ||
|
||
package terraform | ||
|
||
import ( | ||
|
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,36 @@ | ||
// +build integration | ||
|
||
package tests | ||
|
||
import ( | ||
"bytes" | ||
"os" | ||
"os/exec" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
// Add a test that checked that the schema was packed into the binary | ||
// properly. Requires a make clean xbuild-all first. | ||
func TestSchema(t *testing.T) { | ||
schemaBackup := "../pkg/terraform/schema/schema.json.bak" | ||
schemaPath := "../pkg/terraform/schema/schema.json" | ||
|
||
defer os.Rename(schemaBackup, schemaPath) | ||
err := os.Rename(schemaPath, schemaBackup) | ||
require.NoError(t, err, "failed to sabotage the schema.json") | ||
|
||
output := &bytes.Buffer{} | ||
cmd := exec.Command("terraform", "schema") | ||
cmd.Path = "../bin/mixins/terraform/terraform" | ||
cmd.Stdout = output | ||
cmd.Stderr = output | ||
|
||
err = cmd.Start() | ||
require.NoError(t, err, "failed to start the terraform schema command") | ||
|
||
err = cmd.Wait() | ||
t.Log(output) | ||
require.NoError(t, err, "terraform schema failed") | ||
} |