Commit f62b9570 authored by Simon Pastor's avatar Simon Pastor
Browse files

added possibility to add yaml to meep and delete when done, so no trace of systemTest

parent dd19eeff
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -19,10 +19,11 @@ require (
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sandbox-ctrl-client v0.0.0
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-sessions v0.0.0
	github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-wais-client v0.0.0
	github.com/ghodss/yaml v1.0.0
	github.com/gorilla/handlers v1.4.0
	github.com/gorilla/mux v1.7.4
	golang.org/x/sys v0.0.0-20190412213103-97732733099d // indirect
	gopkg.in/yaml.v2 v2.2.2 // indirect
	gopkg.in/yaml.v2 v2.2.2
)

replace (
+3 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@ github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdn
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-redis/redis v6.15.2+incompatible h1:9SpNVG76gr6InJGxoZ6IuuxaCOQwDAhzyXg+Bs+0Sb4=
github.com/go-redis/redis v6.15.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -65,4 +67,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+0 −0

File changed and moved.

Preview size limit exceeded, changes collapsed.

+19 −3
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ func init() {

func initialiseTest() {
	log.Info("activating Scenario")
	err := activateScenario("system-test")
	err := activateScenario("loc-serv-system-test")
	if err != nil {
		log.Fatal("Scenario cannot be activated: ", err)
	}
@@ -62,6 +62,17 @@ func clearUpTest() {
	time.Sleep(1000 * time.Millisecond)
}

//no really a test, but loading the scenarios needed that will be used in the following tests
//deletion of those scenarios at the end
func Test_loc_serv_load_scenarios(t *testing.T) {

	// no override if the name is already in the DB.. security not to override something important
	err := createScenario("loc-serv-system-test", "loc-serv-system-test.yaml")
	if err != nil {
		t.Fatal("cannot create scenario :", err)
	}
}

func Test_4g_to_4g_same_zone_userTracking(t *testing.T) {
	fmt.Println("--- ", t.Name())
	log.MeepTextLogInit(t.Name())
@@ -78,7 +89,7 @@ func Test_4g_to_4g_same_zone_userTracking(t *testing.T) {
	//subscription to test
	err := locServSubscriptionUserTracking(testAddress, locServServerUrl)
	if err != nil {
		t.Fatalf("Subscription failed")
		t.Fatal("Subscription failed: ", err)
	}

	log.Info("moving asset")
@@ -2472,7 +2483,12 @@ func Test_zoneStatus_zone_AP_threshold(t *testing.T) {
}

//not a real test, just the last test that stops the system test environment
func Test_stopSystemTest(t *testing.T) {
func Test_loc_serv_stopSystemTest(t *testing.T) {
	err := deleteScenario("loc-serv-system-test")
	if err != nil {
		log.Error("cannot delete scenario :", err)
	}

	stopSystemTest()
}

+19 −2
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ package main

import (
	"context"
	"encoding/json"
	"errors"
	"io/ioutil"
	"net/http"
@@ -13,6 +14,8 @@ import (
	"syscall"
	"time"

	"github.com/ghodss/yaml"

	gisClient "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-gis-engine-client"
	log "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-logger"
	platformCtrlClient "github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-platform-ctrl-client"
@@ -152,10 +155,24 @@ func deleteSandbox(name string) error {
	return nil
}

func createScenario(name string) error {
func createScenario(name string, filepath string) error {

	//get the content of the file
	content, err := ioutil.ReadFile(filepath)
	if err != nil {
		log.Error("couldn't read file: ", err)
		return err
	}

	jsonContent, err := yaml.YAMLToJSON(content)

	var scenario platformCtrlClient.Scenario
	_, err := platformCtrlAppClient.ScenarioConfigurationApi.SetScenario(context.TODO(), name, scenario)
	err = json.Unmarshal([]byte(jsonContent), &scenario)
	if err != nil {
		log.Error("Failed to unmarshal: ", err)
		return err
	}
	_, err = platformCtrlAppClient.ScenarioConfigurationApi.CreateScenario(context.TODO(), name, scenario)
	if err != nil {
		log.Error("Failed to create scenario: ", err)
		return err
Loading