summaryrefslogtreecommitdiffstats
path: root/test/exec_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/exec_test.go')
-rw-r--r--test/exec_test.go32
1 files changed, 16 insertions, 16 deletions
diff --git a/test/exec_test.go b/test/exec_test.go
index 39f00c6..6ffc350 100644
--- a/test/exec_test.go
+++ b/test/exec_test.go
@@ -24,7 +24,7 @@ import (
"testing"
"gerrit.automotivelinux.org/gerrit/src/xds/xds-server/lib/xsapiv1"
- "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
)
func InitExec(t *testing.T) string {
@@ -34,14 +34,14 @@ func InitExec(t *testing.T) string {
cmd := exec.Command("cp", "-r", helloworldFixturesDir, helloworldDir)
var out bytes.Buffer
cmd.Stdout = &out
- assert.Nil(t, cmd.Run())
+ require.Nil(t, cmd.Run())
/*clone submodules app templates into helloworld*/
subHelloworldAppTemplateDir := path.Join(helloworldDir, "conf.d", "app-templates")
cmd = exec.Command("git", "clone", "-b", "flounder",
"https://gerrit.automotivelinux.org/gerrit/p/apps/app-templates.git",
subHelloworldAppTemplateDir)
- assert.Nil(t, cmd.Run())
+ require.Nil(t, cmd.Run())
return helloworldDir
}
@@ -60,8 +60,8 @@ func TestExec(t *testing.T) {
/*check there is no project*/
var cfgArray []xsapiv1.FolderConfig
- assert.Nil(t, HTTPCli.Get("/folders", &cfgArray))
- assert.Equal(t, len(cfgArray), 0)
+ require.Nil(t, HTTPCli.Get("/folders", &cfgArray))
+ require.Equal(t, len(cfgArray), 0)
fPrj := xsapiv1.FolderConfig{
Label: "testproject",
@@ -74,8 +74,8 @@ func TestExec(t *testing.T) {
}
/*create project*/
var cfg xsapiv1.FolderConfig
- assert.Nil(t, HTTPCli.Post("/folders", fPrj, &cfg))
- assert.NotNil(t, cfg)
+ require.Nil(t, HTTPCli.Post("/folders", fPrj, &cfg))
+ require.NotNil(t, cfg)
/*channel for ExecExitMsg*/
chExec := make(chan xsapiv1.ExecExitMsg)
@@ -99,7 +99,7 @@ func TestExec(t *testing.T) {
}
Debugf(t, "exec cmake cmd(%v)", cmd)
cmdOut = ""
- assert.NotNil(t, HTTPCli.Post("/exec", exec, &execRes))
+ require.NotNil(t, HTTPCli.Post("/exec", exec, &execRes))
/*basic check: verify that environment is set correctly (use the right sdk)*/
cmd = "pwd && echo \"SDKTARGETSYSROOT=<$SDKTARGETSYSROOT>\""
@@ -110,9 +110,9 @@ func TestExec(t *testing.T) {
}
Debugf(t, "exec cmake cmd(%v)", cmd)
cmdOut = ""
- assert.Nil(t, HTTPCli.Post("/exec", exec, &execRes))
+ require.Nil(t, HTTPCli.Post("/exec", exec, &execRes))
exitMsg := <-chExec
- assert.Equal(t, exitMsg.Code, 0)
+ require.Equal(t, exitMsg.Code, 0)
/*cmake helloworld project with fake sdk*/
cmd = "cd " + fPrj.ClientPath
@@ -129,9 +129,9 @@ func TestExec(t *testing.T) {
Cmd: cmd,
}
Debugf(t, "exec cmake cmd(%v)", cmd)
- assert.Nil(t, HTTPCli.Post("/exec", exec, &execRes))
+ require.Nil(t, HTTPCli.Post("/exec", exec, &execRes))
exitMsg = <-chExec
- assert.Equal(t, exitMsg.Code, 0)
+ require.Equal(t, exitMsg.Code, 0)
/*make helloworld project with fake sdk*/
cmd = "cd " + fPrj.ClientPath
@@ -142,17 +142,17 @@ func TestExec(t *testing.T) {
exec.Cmd = cmd
/*post exec cmd make*/
Debugf(t, "exec make cmd(%v)", cmd)
- assert.Nil(t, HTTPCli.Post("/exec", exec, &execRes))
+ require.Nil(t, HTTPCli.Post("/exec", exec, &execRes))
exitMsg = <-chExec
- assert.Equal(t, exitMsg.Code, 0)
+ require.Equal(t, exitMsg.Code, 0)
/*check if helloworld.so exists*/
Debug(t, "check that helloworld.so exists")
_, err := os.Stat(path.Join(fPrj.ClientPath, "build/helloworld/helloworld.so"))
- assert.Nil(t, err)
+ require.Nil(t, err)
/*deinit*/
- assert.Nil(t, HTTPCli.Delete("/folders/"+cfg.ID, &cfg))
+ require.Nil(t, HTTPCli.Delete("/folders/"+cfg.ID, &cfg))
RemoveSdk(t, sdkRes, chSdks)
DisconnectSDKStateChange(t, sCli)
}