Add makefile

This commit is contained in:
Shorssaud 2023-02-16 17:52:40 +01:00
parent 490d388dca
commit 1b8b080e24
2 changed files with 57 additions and 49 deletions

9
Makefile Normal file
View File

@ -0,0 +1,9 @@
# Create a makefile that runs all the tests in tests/
SRC = $(wildcard tests/*.go)
all:
go test $(SRC)
verbose:
go test -v $(SRC)

View File

@ -28,8 +28,8 @@ func TestUpload1(t *testing.T) {
group, groupCtx := errgroup.WithContext(context.Background())
addrs := "127.0.0.1"
for i, node := range nodes {
id := i
node := node.Context(groupCtx)
if i <= 1 {
group.Go(func() error {
// gets node ip
ip, err := getIp(groupCtx, node)
@ -54,9 +54,10 @@ func TestUpload1(t *testing.T) {
runout := &bytes.Buffer{}
runerr := &bytes.Buffer{}
time.Sleep(2 * time.Second)
if i == 1 {
if id == 1 {
node.SendFile("tests/dog1.txt", bytes.NewBuffer([]byte("hello my dog")))
for x := 0; x < 2; x++ {
for x := 0; x < 10; x++ {
group.Go(func() error {
proc, err := node.StartProc(cluster.StartProcRequest{
Command: "curl",
@ -72,7 +73,6 @@ func TestUpload1(t *testing.T) {
t.Errorf(Fatal("HOST EOutput: %s\n", err))
return err
}
t.Log(Info("HOST Output: ") + runout.String())
assert.Equal(t, 0, code.ExitCode, "HOST EOutput: %s\n", runerr.String())
return nil
})
@ -81,7 +81,6 @@ func TestUpload1(t *testing.T) {
return nil
})
}
}
group.Wait()
})