summaryrefslogtreecommitdiffstats
path: root/test/xdsserver_test.go
diff options
context:
space:
mode:
authorClément Bénier <clement.benier@iot.bzh>2018-07-27 11:37:51 +0200
committerClément Bénier <clement.benier@iot.bzh>2018-08-21 11:08:36 +0200
commita70639fb60bfbe5899f580a48222b47f435ca1f8 (patch)
treee4af15b94f1c1255ab8cae03a236b9cfd0f7ebc8 /test/xdsserver_test.go
parentdb0df685e9dc40fdd53113caaac976d12fd73435 (diff)
functionnal test: install test install fake sdk
install a fake sdk and waiting for event to end the test Change-Id: I5c2125f32a1fb4a80f9b251174d15117eef26f9a Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
Diffstat (limited to 'test/xdsserver_test.go')
-rw-r--r--test/xdsserver_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/xdsserver_test.go b/test/xdsserver_test.go
index 5722d31..76c54ea 100644
--- a/test/xdsserver_test.go
+++ b/test/xdsserver_test.go
@@ -17,9 +17,11 @@
package xdsservertest
import (
+ "io"
"log"
"os"
"os/exec"
+ "path"
"testing"
"time"
@@ -32,6 +34,26 @@ var HTTPCli *common.HTTPClient
var logDir string
var sdkDir string
+func Copy(src, dst string) error {
+ in, err := os.Open(src)
+ if err != nil {
+ return err
+ }
+ defer in.Close()
+
+ out, err := os.Create(dst)
+ if err != nil {
+ return err
+ }
+ defer out.Close()
+
+ _, err = io.Copy(out, in)
+ if err != nil {
+ return err
+ }
+ return out.Close()
+}
+
func initEnv(launchProcess bool) {
if launchProcess {
cmd := exec.Command("killall", "-9", "xds-server")
@@ -62,6 +84,13 @@ func initEnv(launchProcess bool) {
logDir = rootTestLog + "/logs/"
os.MkdirAll(logDir, 0755)
os.MkdirAll(sdkDir, 0755)
+ currentDir, err := os.Getwd()
+ if err != nil {
+ log.Fatal(err)
+ }
+ if err := Copy(path.Join(currentDir, sdkFile), path.Join(sdkDir, sdkFileName)); err != nil {
+ log.Fatal(err)
+ }
}
func launchXdsServer(proc **os.Process) *os.File {