shad-go/distbuild/disttest/simple_test.go

34 lines
641 B
Go
Raw Normal View History

2020-03-11 22:46:45 +00:00
package disttest
import (
"testing"
2020-03-12 22:33:54 +00:00
"github.com/stretchr/testify/assert"
2020-03-11 22:46:45 +00:00
"github.com/stretchr/testify/require"
"gitlab.com/slon/shad-go/distbuild/pkg/build"
)
var echoGraph = build.Graph{
Jobs: []build.Job{
{
ID: build.ID{'a'},
Name: "echo",
Cmds: []build.Cmd{
2020-03-14 10:24:44 +00:00
{Exec: []string{"echo", "OK"}},
2020-03-11 22:46:45 +00:00
},
},
},
}
func TestSingleCommand(t *testing.T) {
env, cancel := newEnv(t)
defer cancel()
2020-03-14 10:24:44 +00:00
recorder := NewRecorder()
require.NoError(t, env.Client.Build(env.Ctx, echoGraph, recorder))
2020-03-11 22:46:45 +00:00
2020-03-14 10:24:44 +00:00
assert.Len(t, recorder.Jobs, 1)
assert.Equal(t, &JobResult{Stdout: "OK\n", Code: new(int)}, recorder.Jobs[build.ID{'a'}])
2020-03-11 22:46:45 +00:00
}