-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert integration tests to use TestScript
- Loading branch information
Showing
10 changed files
with
95 additions
and
121 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//go:build integration | ||
|
||
package jkl_test | ||
|
||
// Note: Use go test -testwork to preserve the TestScript temporary directory. | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/ivanfetch/jkl" | ||
"github.com/rogpeppe/go-internal/testscript" | ||
) | ||
|
||
func init() { | ||
// Enable debugging for all tests, via the same environment variable the jkl | ||
// binary uses. | ||
if os.Getenv("JKL_DEBUG") != "" { | ||
jkl.EnableDebugOutput() | ||
} | ||
} | ||
|
||
func TestScript(t *testing.T) { | ||
testscript.Run(t, testscript.Params{ | ||
Dir: "testdata/script", | ||
}) | ||
} |
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,8 @@ | ||
mkdir $WORK/home/testuser | ||
env HOME=$WORK/home/testuser | ||
env PATH=$HOME/.jkl/bin:$PATH | ||
exec jkl install github:cli/cli:2.14.2 | ||
! stdout . | ||
! stderr . | ||
exec gh version | ||
stdout 'gh version 2.14.2' |
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,8 @@ | ||
mkdir $WORK/home/testuser | ||
env HOME=$WORK/home/testuser | ||
env PATH=$HOME/.jkl/bin:$PATH | ||
exec jkl install github:kubernetes-sigs/kind:0.14.0 | ||
! stdout . | ||
! stderr . | ||
exec kind version | ||
stdout 'kind v0.14.0' |
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,19 @@ | ||
mkdir $WORK/home/testuser | ||
env HOME=$WORK/home/testuser | ||
env PATH=$HOME/.jkl/bin:$PATH | ||
exec jkl install github:ivanfetch/prme:0.0.4 | ||
! stdout . | ||
! stderr . | ||
# prme -version exits with value 1 | ||
! exec prme -version | ||
! stdout . | ||
# A prme bug does not present the version correctly | ||
stderr 'prme version ,' | ||
# Install the latest prme | ||
exec jkl install github:ivanfetch/prme | ||
! stdout . | ||
! stderr . | ||
env JKL_PRME=latest | ||
! exec prme -version | ||
! stdout . | ||
stderr 'prme version v0.0.6' |
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,19 @@ | ||
mkdir $WORK/home/testuser | ||
env HOME=$WORK/home/testuser | ||
env PATH=$HOME/.jkl/bin:$PATH | ||
exec jkl install hashi:terraform:1.0.0 | ||
! stdout . | ||
! stderr . | ||
exec terraform version | ||
stdout 'Terraform v1.0.0' | ||
# This version requires jkl to fetch jultiple pages of Hashicorp releases | ||
exec jkl install hashicorp:terraform:0.11.15 | ||
! stdout . | ||
! stderr . | ||
env JKL_TERRAFORM=0.11.15 | ||
exec terraform version | ||
stdout 'Terraform v0.11.15' | ||
# This version does not exist | ||
! exec jkl install hashicorp:terraform:10.2 | ||
! stdout . | ||
stderr 'Error: no version found to match "10.2"' |
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,5 @@ | ||
mkdir $WORK/home/testuser | ||
env HOME=$WORK/home/testuser | ||
exec jkl install hashi:terraform:1.0.0 | ||
stdout 'WARNING: Please add the directory' | ||
stdout 'to your PATH environment variable' |
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,3 @@ | ||
exec jkl version | ||
stdout 'jkl version' | ||
stdout 'git commit ' |