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

updated some error logs

parent f62b9570
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ 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)
		t.Fatal("Cannot create scenario, keeping the one already there and continuing testing with it :", err)
	}
}

+9 −4
Original line number Diff line number Diff line
@@ -157,14 +157,19 @@ func deleteSandbox(name string) error {

func createScenario(name string, filepath string) error {

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

	jsonContent, err := yaml.YAMLToJSON(content)
	//converting to json since unmarshal with yaml directly not working well, while json does
	jsonContent, err := yaml.YAMLToJSON(yamlContent)
        if err != nil {
                log.Error("Failed converting yaml to json: ", err)
                return err
        }

	var scenario platformCtrlClient.Scenario
	err = json.Unmarshal([]byte(jsonContent), &scenario)