-
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.
introducing experimental terminal based gui (#84)
* introducing progress listener api * working matrix view * added docker based manual tests
- Loading branch information
Showing
38 changed files
with
884 additions
and
252 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
vendor | ||
bin | ||
build |
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,7 @@ | ||
FROM golang:1.16 | ||
|
||
ADD . /benchy | ||
|
||
WORKDIR /benchy | ||
|
||
RUN make go-build-linux-amd64 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package cli | ||
package api | ||
|
||
import ( | ||
"io" | ||
|
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,12 @@ | ||
package api | ||
|
||
// Listener a listener for benchmark progress events | ||
type Listener interface { | ||
OnBenchmarkStart() | ||
OnBenchmarkEnd() | ||
OnScenarioStart(id ID) | ||
OnScenarioEnd(id ID) | ||
OnMessagef(id ID, format string, args ...interface{}) | ||
OnMessage(id ID, message string) | ||
OnError(id ID, err error) | ||
} |
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,47 +1,57 @@ | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
"os" | ||
"os/exec" | ||
"testing" | ||
|
||
"github.com/sha1n/termite" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
var runMainCommand = []string{ | ||
"go", | ||
"run", | ||
"-mod=readonly", | ||
"main.go", | ||
} | ||
|
||
func TestExitCodeWhenRequiredConfigArgIsMissing(t *testing.T) { | ||
expectedExitCode := 1 | ||
buf := new(bytes.Buffer) | ||
|
||
cmd := exec.Command(runMainCommand[0], runMainCommand[1:]...) | ||
|
||
cmd.Stdout = buf | ||
cmd.Stderr = buf | ||
|
||
assert.NoError(t, cmd.Start()) | ||
state, err := cmd.Process.Wait() | ||
|
||
assert.Contains(t, buf.String(), "Error: required flag(s) \"config\" not set") | ||
assert.NoError(t, err) | ||
assert.Equal(t, expectedExitCode, state.ExitCode()) | ||
|
||
} | ||
|
||
func TestExitCodeWithMissingConfig(t *testing.T) { | ||
expectedExitCode := 1 | ||
func TestExitCodeWithMissingRequiredArguments(t *testing.T) { | ||
expectedPanicExitCode := 1 | ||
actualExitcode := 0 | ||
|
||
os.Args = []string{} | ||
doRun(func(i int) { | ||
actualExitcode = i | ||
}) | ||
|
||
assert.Equal(t, expectedExitCode, actualExitcode) | ||
assert.Equal(t, expectedPanicExitCode, actualExitcode) | ||
} | ||
|
||
func TestSanity(t *testing.T) { | ||
testWith( | ||
t, | ||
[]string{ | ||
"program", | ||
"-c", | ||
"../test/data/integration.yaml", | ||
"--debug", | ||
"--pipe-stdout", | ||
"--pipe-stderr", | ||
}, | ||
true, | ||
func(t *testing.T) { | ||
doRun(func(code int) { | ||
assert.Equal(t, 0, code) | ||
}) | ||
}, | ||
) | ||
} | ||
|
||
func testWith(t *testing.T, args []string, tty bool, test func(t *testing.T)) { | ||
origTtyValue := termite.Tty | ||
origOsArgs := os.Args | ||
termite.Tty = true | ||
|
||
defer func() { | ||
termite.Tty = origTtyValue | ||
os.Args = origOsArgs | ||
}() | ||
|
||
os.Args = args | ||
termite.Tty = tty | ||
|
||
test(t) | ||
} |
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
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
Oops, something went wrong.