diff --git a/import-export-cli/integration/README.md b/import-export-cli/integration/README.md index c666b8d91..50bbbed15 100644 --- a/import-export-cli/integration/README.md +++ b/import-export-cli/integration/README.md @@ -4,7 +4,7 @@ 1. In order to run the integration tests, two instances of API Manager need to be started. By default integration tests are configured to run against local instances with port offset 0 and 1. If you need to configure the instances differently, it can be done as explained later on in the document. These two instances will act as the APIM environments that will be used for testing exporting and importing scenarios respectively. The integration tests will execute apictl commands, DCR calls, REST API calls and admin service calls against these instances. 2. Before starting the APIM instances update the APIM *deployment.toml* to allow the `@` character as part of the service provider name. This is to support DCR for tenant users since the `@` is part of the username. The updated config should look as follows, - +(**If this test suite is running on a Windows machine, make sure to disable security scans and security guards of that machine prior to the test suite starts.) ``` [service_provider] sp_name_regex = "^[@\\sa-zA-Z0-9._-]*$" diff --git a/import-export-cli/integration/base/helper.go b/import-export-cli/integration/base/helper.go index 51d622102..e97df2b11 100644 --- a/import-export-cli/integration/base/helper.go +++ b/import-export-cli/integration/base/helper.go @@ -308,7 +308,14 @@ func CreateTempDir(t *testing.T, path string) { } func GetExportedPathFromOutput(output string) string { - return strings.ReplaceAll(strings.ReplaceAll(output[strings.Index(output, string(os.PathSeparator)):], "\n", ""), " ", "") + //Check directory path to omit changes due to OS differences + if strings.Contains(output, ":\\") { + arrayOutput := []rune (output) + extractedPath := string(arrayOutput[strings.Index(output, ":\\")-1:]) + return strings.ReplaceAll(strings.ReplaceAll(extractedPath, "\n", ""), " ", "") + } else { + return strings.ReplaceAll(strings.ReplaceAll(output[strings.Index(output, string(os.PathSeparator)):], "\n", ""), " ", "") + } } //Count number of files in a directory diff --git a/import-export-cli/integration/environmnet_test.go b/import-export-cli/integration/environmnet_test.go index f9c03a3f0..993dc8652 100644 --- a/import-export-cli/integration/environmnet_test.go +++ b/import-export-cli/integration/environmnet_test.go @@ -65,9 +65,9 @@ func TestChangeExportDirectory(t *testing.T) { }) apimClient := apimClients[0] - projectName := "OpenAPI3Project" - apiName := "SwaggerPetstoreNew" - apiVersion := "1.0.0" + projectName := base.GenerateRandomName(16) + apiName := testutils.DevFirstDefaultAPIName + apiVersion := testutils.DevFirstDefaultAPIVersion username := superAdminUser password := superAdminPassword diff --git a/import-export-cli/integration/testutils/environment_testUtils.go b/import-export-cli/integration/testutils/environment_testUtils.go index 54d1d992c..507a1984e 100644 --- a/import-export-cli/integration/testutils/environment_testUtils.go +++ b/import-export-cli/integration/testutils/environment_testUtils.go @@ -114,8 +114,8 @@ func ValidateExportApiPassed(t *testing.T, args *ApiImportExportTestArgs, direct //Derive exported path from output exportedPath := filepath.Dir(base.GetExportedPathFromOutput(output)) - assert.True(t, strings.HasPrefix(exportedPath, directoryName), "API doesn't seem to exported to the "+ - "changed exported location. Expected in "+directoryName+" but it is exported in "+exportedPath) + assert.True(t, strings.HasPrefix(exportedPath, directoryName), "API export path "+exportedPath+" is"+ + " not within the expected export location "+directoryName) assert.True(t, base.IsAPIArchiveExists(t, exportedPath, args.Api.Name, args.Api.Version), "API archive"+ " is not correctly exported to "+directoryName)