From 4c50b2834071e8944fc6e83d491175828101a5e5 Mon Sep 17 00:00:00 2001 From: Neil-Jocelyn Schark <neil.schark@h-da.de> Date: Fri, 13 Sep 2024 14:32:03 +0000 Subject: [PATCH] move tls config in test --- .../code/getKSAKeyTest/getKSA_key_test.go | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/integration-tests/code/getKSAKeyTest/getKSA_key_test.go b/integration-tests/code/getKSAKeyTest/getKSA_key_test.go index a1b9c137..d58caae8 100644 --- a/integration-tests/code/getKSAKeyTest/getKSA_key_test.go +++ b/integration-tests/code/getKSAKeyTest/getKSA_key_test.go @@ -79,15 +79,24 @@ func TestGetKSAKey(t *testing.T) { //nolint:gocyclo logFileURL2 = logFileURL_ENV2 } + // TLS stuff tlsConfig := config.TLSConfig{ Active: true, CAFile: "../../../artifacts/integration-tests/ssl/ca.crt", CertFile: "../../../artifacts/integration-tests/ssl/integration_test.crt", KeyFile: "../../../artifacts/integration-tests/ssl/integration_test.key", } + tlsConf, err := kmstls.GenerateTLSLibraryConfig(tlsConfig) + if err != nil { + t.Errorf("Error generating TLS config: %s", err) + } + transport := &http.Transport{ + TLSClientConfig: tlsConf, + } + client := &http.Client{Transport: transport} // Tell the qkdn-controller what devices to use. - _, err := utils.RunGosdncScript(gosdncScript, controllerURL) + _, err = utils.RunGosdncScript(gosdncScript, controllerURL) if err != nil { currentFolderPath := os.Getenv("PWD") t.Errorf("Error running gosdnc script. Current folder path: %s, Error: %s", currentFolderPath, err) @@ -108,15 +117,6 @@ func TestGetKSAKey(t *testing.T) { //nolint:gocyclo }, } - tlsConf, err := kmstls.GenerateTLSLibraryConfig(tlsConfig) - if err != nil { - t.Errorf("Error generating TLS config: %s", err) - } - transport := &http.Transport{ - TLSClientConfig: tlsConf, - } - client := &http.Client{Transport: transport} - jsonData, err := json.Marshal(data) if err != nil { fmt.Println(err) -- GitLab