From 6fed8dcdad2bd238c72516d8182a34fff365ab0f Mon Sep 17 00:00:00 2001 From: Carl Meijer Date: Fri, 7 Feb 2025 13:04:58 +0200 Subject: [PATCH] Remove bash test runner script. --- integration/integration_test.go | 11 ++++++++++- integration/run.sh | 6 ------ 2 files changed, 10 insertions(+), 7 deletions(-) delete mode 100755 integration/run.sh diff --git a/integration/integration_test.go b/integration/integration_test.go index 98f10b1..33947d1 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -30,7 +30,7 @@ import ( var client *rest.SynkClient -func init() { +func getConfigFromVars() *configuration.Configuration { // If we can't create a client, no tests will pass so // we just panic if something goes wrong. username := os.Getenv("TEST_USER") @@ -53,6 +53,15 @@ func init() { panic("the TEST_INVERTER_SN environment variable must be set") } config.DefaultInverterSN = serialNumber + return config +} + +func init() { + configFile, _ := configuration.DefaultConfigurationFile() + config, err := configuration.ReadConfigurationFromFile(configFile) + if err != nil { + config = getConfigFromVars() + } // Allow multiple attempts to authenticate, in case of flakiness somewhere. // Also, increase the delay between attempts. diff --git a/integration/run.sh b/integration/run.sh deleted file mode 100755 index 612ff3b..0000000 --- a/integration/run.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -export TEST_USER=$(grep user $HOME/.synk/config | cut -d: -f2 | tr -d ' ') -export TEST_PASSWORD=$(grep password $HOME/.synk/config | cut -d: -f2 | tr -d ' ') -export TEST_INVERTER_SN=$(grep default_inverter_sn $HOME/.synk/config | cut -d: -f2 | tr -d ' ') -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -go test -v -count=1 -tags integration $SCRIPT_DIR