diff --git a/README.md b/README.md
index 8015a61..b911774 100644
--- a/README.md
+++ b/README.md
@@ -43,6 +43,9 @@
Test Center is a testing tool that checks the effect of configuration changes on your web property. Use this CLI as part of your testing protocol to increase your confidence in the safety and accuracy of your configuration changes.
+> **_Breaking changes_**: Due to the active development of the new Test Center experience, we implemented the following changes to the CLI:
1. In the `clientProfile` object, the `clientType` field is changed to `client` with values `CHROME` and `CURL`.
2. In a test suite object, the `testCaseCount` field changed to `executableTestCaseCount`. This change is caused by the [Variables group](https://techdocs.akamai.com/test-ctr/v3/reference/variables-overview) feature.
Impacted operations:
- [List test suites](#list-test-suites),
- [Add a test case to a test suite](#add-a-test-case-to-a-test-suite),
- [Generate a default test suite for a property](#generate-a-default-test-suite-for-a-property),
- [Import a test suite](#import-a-test-suite).
Implement necessary changes in your objects before running these operations.
+
+
## Install Test Center CLI
To install this CLI, you need the [Akamai CLI](https://github.com/akamai/cli) package manager. Once you install the Akamai CLI, run this command:
diff --git a/cli.json b/cli.json
index 8a1c18b..852ff43 100644
--- a/cli.json
+++ b/cli.json
@@ -4,7 +4,7 @@
},
"commands": [{
"name": "test-center",
- "version": "0.1.1",
+ "version": "0.2.0",
"description": "Test Center is a testing tool that checks the effect of configuration changes on your web property. Use this tool as part of your testing protocol to increase your confidence in the safety and accuracy of your configuration changes.",
"bin": "https://github.com/akamai/cli-test-center/releases/download/{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}"
}]
diff --git a/cmd/command_usage_and_example_constants.go b/cmd/command_usage_and_example_constants.go
index da91ca0..feeea01 100644
--- a/cmd/command_usage_and_example_constants.go
+++ b/cmd/command_usage_and_example_constants.go
@@ -57,13 +57,13 @@ const (
TestSuiteRestoreExample = ` $ akamai test-center test-suite restore --name "Test suite name"
$ akamai test-center test-suite restore --id 12345`
- TestSuiteViewUse = "view [--id ID | --name NAME] [--group-by test-request | condition | ipversion]"
+ TestSuiteViewUse = "view [--id ID | --name NAME] [--group-by test-request | condition | ip-version]"
TestSuiteViewExample = ` $ akamai test-center test-suite view --id 1001
$ akamai test-center test-suite view --name 'Example TS' --group-by test-request`
TestSuiteViewCommandAliases = "export"
ConditionTemplateUse = "conditions"
- ConditionTemplateExample = " $ akamai test-center conditions"
+ ConditionTemplateExample = ` $ akamai test-center conditions`
)
// Flag Names
@@ -120,3 +120,10 @@ const (
FlagSectionDefaultValue = "test-center"
FlagIpVersionDefaultValue = "V4"
)
+
+// Environment variable Constants
+const (
+ DefaultEdgercPathKey = "AKAMAI_EDGERC"
+ DefaultEdgercSectionKey = "AKAMAI_EDGERC_SECTION"
+ DefaultJsonOutputKey = "AKAMAI_OUTPUT_JSON"
+)
diff --git a/cmd/root.go b/cmd/root.go
index 26e2c24..f5e61df 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -2,12 +2,13 @@ package cmd
import (
"errors"
- "os"
-
"github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid"
"github.com/akamai/cli-test-center/internal"
"github.com/fatih/color"
+ "github.com/mitchellh/go-homedir"
"github.com/spf13/cobra"
+ "os"
+ "path/filepath"
"strconv"
)
@@ -71,6 +72,21 @@ func init() {
rootCmd.SilenceErrors = true
rootCmd.SilenceUsage = true
+ // Setting the default values for the global flags from environment variable.
+ defaultEdgercPath := os.Getenv(DefaultEdgercPathKey)
+ defaultEdgercSection := os.Getenv(DefaultEdgercSectionKey)
+ globalJsonFlag, _ := strconv.ParseBool(os.Getenv(DefaultJsonOutputKey))
+
+ if defaultEdgercPath == internal.Empty {
+ if home, err := homedir.Dir(); err == nil {
+ defaultEdgercPath = filepath.Join(home, FlagEdgercDefaultValue)
+ }
+ }
+
+ if defaultEdgercSection == internal.Empty {
+ defaultEdgercSection = FlagSectionDefaultValue
+ }
+
rootCmd.SetFlagErrorFunc(func(cmd *cobra.Command, err error) error {
internal.PrintError(err.Error() + "\n\n")
cmd.Println(cmd.UsageString())
@@ -80,10 +96,10 @@ func init() {
rootCmd.Short = internal.GetMessageForKey(rootCmd, internal.Short)
rootCmd.Long = internal.GetMessageForKey(rootCmd, internal.Long)
- rootCmd.PersistentFlags().StringVar(&edgeRcPath, FlagEdgerc, FlagEdgercDefaultValue, internal.GetMessageForKey(rootCmd, FlagEdgerc))
- rootCmd.PersistentFlags().StringVar(&edgeRcSection, FlagSection, FlagSectionDefaultValue, internal.GetMessageForKey(rootCmd, FlagSection))
- rootCmd.PersistentFlags().StringVar(&accountSwitchKey, FlagAccountKey, "", internal.GetMessageForKey(rootCmd, FlagAccountKey))
- rootCmd.PersistentFlags().BoolVar(&jsonOutput, FlagJson, false, internal.GetMessageForKey(rootCmd, FlagJson))
+ rootCmd.PersistentFlags().StringVar(&edgeRcPath, FlagEdgerc, defaultEdgercPath, internal.GetMessageForKey(rootCmd, FlagEdgerc))
+ rootCmd.PersistentFlags().StringVar(&edgeRcSection, FlagSection, defaultEdgercSection, internal.GetMessageForKey(rootCmd, FlagSection))
+ rootCmd.PersistentFlags().StringVar(&accountSwitchKey, FlagAccountKey, internal.Empty, internal.GetMessageForKey(rootCmd, FlagAccountKey))
+ rootCmd.PersistentFlags().BoolVar(&jsonOutput, FlagJson, globalJsonFlag, internal.GetMessageForKey(rootCmd, FlagJson))
rootCmd.PersistentFlags().BoolVar(&forceColor, FlagForceColor, false, internal.GetMessageForKey(rootCmd, FlagForceColor))
rootCmd.Flags().BoolP(FlagHelp, FlagHelpShortHand, false, internal.GetMessageForKey(rootCmd, FlagHelp))
rootCmd.Flags().BoolP(FlagVersion, FlagVersionShortHand, false, internal.GetMessageForKey(rootCmd, FlagVersion))
diff --git a/cmd/test_suites_add_test_case.go b/cmd/test_suites_add_test_case.go
index bfe28ad..54e5237 100644
--- a/cmd/test_suites_add_test_case.go
+++ b/cmd/test_suites_add_test_case.go
@@ -21,7 +21,7 @@ var testSuitesAddTestCaseCmd = &cobra.Command{
//Check if all required flag are present.
validator.AddTestCaseToTestSuiteFlagCheck(testSuiteIdStr, testSuiteName, url, condition, ipVersion, addHeader, modifyHeader)
- testSuites := svc.GetTestSuitesByIdOrName(testSuiteIdStr, testSuiteName, internal.Empty, true, false)
+ testSuites := svc.GetTestSuitesByIdOrName(testSuiteIdStr, testSuiteName, internal.Empty, true, false, true)
svc.AddTestCaseWithTestSuite(testSuites, testSuiteName, url, condition, ipVersion, addHeader, modifyHeader, filterHeader)
},
}
diff --git a/cmd/test_suites_remove_test_case.go b/cmd/test_suites_remove_test_case.go
index 642c83f..627c8d9 100644
--- a/cmd/test_suites_remove_test_case.go
+++ b/cmd/test_suites_remove_test_case.go
@@ -23,7 +23,7 @@ var testSuitesRemoveTestCaseCmd = &cobra.Command{
validator.RemoveTestCaseFromTestSuiteFlagCheck(testSuiteIdStr, orderNumber)
testSuiteId, _ := strconv.Atoi(testSuiteIdStr)
- testSuite := svc.GetSingleTestSuiteByIdOrName(testSuiteIdStr, "", internal.Empty)
+ testSuite := svc.GetSingleTestSuiteByIdOrName(testSuiteIdStr, "", internal.Empty, true)
testCases, _ := svc.GetV3AssociatedTestCasesForTestSuite(testSuiteId)
svc.RemoveTestCaseFromTestSuiteUsingOrderNumber(testSuite, testCases, orderNumber)
},
diff --git a/go.mod b/go.mod
index afbbe46..54c7548 100644
--- a/go.mod
+++ b/go.mod
@@ -10,6 +10,7 @@ require (
github.com/fatih/color v1.12.0
github.com/google/uuid v1.3.0 // indirect
github.com/jinzhu/copier v0.3.2
+ github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/oleiade/reflections v1.0.1
github.com/olekukonko/tablewriter v0.0.5
github.com/sirupsen/logrus v1.8.1
diff --git a/internal/api_client.go b/internal/api_client.go
index f17ef68..d9f0825 100644
--- a/internal/api_client.go
+++ b/internal/api_client.go
@@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
"net/url"
+ "strconv"
"github.com/clarketm/json"
log "github.com/sirupsen/logrus"
@@ -100,9 +101,9 @@ func (api ApiClient) GetTestRunContext(testRunId int) (*TestRunContext, *CliErro
return nil, CliErrorFromPulsarProblemObject(*byt, nil, resp.StatusCode, ApiErrorTestRunContextGetCall)
}
-func (api ApiClient) GetTestSuitesV3(propertyName, propVersion, user string) ([]TestSuiteV3, *CliError) {
+func (api ApiClient) GetTestSuitesV3(propertyName, propVersion, user string, includeDeleted bool) ([]TestSuiteV3, *CliError) {
- v3Path := "/test-management/v3/functional/test-suites?includeRecentlyDeleted=true"
+ v3Path := "/test-management/v3/functional/test-suites?includeRecentlyDeleted=" + strconv.FormatBool(includeDeleted)
tsV3Url, _ := url.Parse(v3Path)
// add optional query parameters
diff --git a/internal/constants.go b/internal/constants.go
index 2116afa..3c0da6f 100644
--- a/internal/constants.go
+++ b/internal/constants.go
@@ -40,9 +40,9 @@ const (
Ipv6 = "IPV6"
)
-// Browser ClientTypes
+// Chrome Client
const (
- Browser = "BROWSER"
+ Chrome = "CHROME"
)
// Environments
diff --git a/internal/edge_grid_http_client.go b/internal/edge_grid_http_client.go
index 68b53ec..61d8b26 100644
--- a/internal/edge_grid_http_client.go
+++ b/internal/edge_grid_http_client.go
@@ -2,7 +2,7 @@ package internal
import (
"bytes"
- "io/ioutil"
+ "io"
"net/http"
"net/url"
"os"
@@ -69,8 +69,8 @@ func (h EdgeGridHttpClient) request(method string, path string, payload *[]byte,
os.Exit(ExitStatusCode1)
}
defer resp.Body.Close()
+ byt, err := io.ReadAll(resp.Body)
- byt, err := ioutil.ReadAll(resp.Body)
if err != nil {
AbortWithExitCode(err.Error(), ExitStatusCode1)
}
diff --git a/internal/en_US.json b/internal/en_US.json
index 2a80f17..9b32fd5 100644
--- a/internal/en_US.json
+++ b/internal/en_US.json
@@ -549,7 +549,9 @@
"externalApiDataError": "At least one property in your account is tied to multiple groups in Control Center. Test Center requires the property to be tied to exactly one group. Contact Akamai technical support to fix this.",
"maxAssociationsExceeded": "The number of test cases in this test suite exceeded the limit of '{{maxLimit}}'. Create a new test suite for test cases exceeding the limit.",
"clientProfileOfExistingAssociatedTestCasesDoNotMatch": "The test suite to which you are trying to add test cases is stateful. It accepts only test cases with the same client profile as test cases already included in the test suite. Change the test cases or add it to a different test suite.",
- "testCasesContainsHeterogeneousClientProfiles": "In stateful test suites, test cases need to have the same client profile. Edit the test cases and try again."
+ "testCasesContainsHeterogeneousClientProfiles": "In stateful test suites, test cases need to have the same client profile. Edit the test cases and try again.",
+ "requiredFieldMissing": "The '{{requestField}}' is missing.",
+ "hostnameAccessMissing": "You don't have access to all the hostnames of included test cases. Get the access or edit the hostnames and try again."
},
"subCommand": {
"invalid": {
@@ -789,7 +791,7 @@
"configVersionIdTestSuiteIdAssociationNotFound": "Some of the property versions and test suites associations could not be found. Verify the associations and try again.",
"testSuiteIdTestCaseIdAssociationNotFound": "Some of the test suites and test cases associations could not be found. Verify the associations and try again."
},
- "invalidClientTypeRequestMethodCombination": "Invalid combination of client type and request method. HEAD and POST request methods are allowed only with CURL client Type."
+ "invalidClientRequestMethodCombination": "Invalid combination of client and request method. HEAD and POST request methods are allowed only with CURL client."
},
"rateLimitExceeded": {
"rateLimitTestRunHostnameExceeded": "The number of test runs for a hostname exceeded the rate limit. Try again later."
diff --git a/internal/print_test_center_utils.go b/internal/print_test_center_utils.go
index 0d996c3..30e88c1 100644
--- a/internal/print_test_center_utils.go
+++ b/internal/print_test_center_utils.go
@@ -19,45 +19,45 @@ type GroupedTestCases struct {
Value []TestCase
}
-func GetFunctionalContextMap(testRunContext *TestRunContext) (*FunctionalContextMap, *CliError) {
- functionalContext := testRunContext.Functional
+func GetFunctionalContextMap(testRun *TestRun) (*FunctionalContextMap, *CliError) {
+ testSuiteExecutions := testRun.Functional.TestSuiteExecutionsV3
var functionalContextMap = FunctionalContextMap{}
- functionalContextMap.ConfigVersionsMap = make(map[int]ConfigVersionContextMap)
+ functionalContextMap.PropertyManagersMap = make(map[int]PropertyManagerContextMap)
- for _, configVersionContext := range functionalContext.ConfigVersions {
- var configVersionContextMap ConfigVersionContextMap
- err := copier.Copy(&configVersionContextMap, &configVersionContext)
- if err != nil {
- log.Errorln(err)
- return nil, CliErrorWithMessage(CliErrorMessageTestRunContext)
- }
- configVersionContextMap.TestSuitesMap = testSuiteContextListToMap(configVersionContext.TestSuites)
- functionalContextMap.ConfigVersionsMap[configVersionContext.ConfigVersionId] = configVersionContextMap
+ propertyManagerContext := testRun.Functional.PropertyManagerExecution
+
+ var propertyManagerContextMap PropertyManagerContextMap
+ err := copier.Copy(&propertyManagerContextMap, &propertyManagerContext.PropertyVersion)
+ if err != nil {
+ log.Errorln(err)
+ return nil, CliErrorWithMessage(CliErrorMessageTestRunContext)
}
+ propertyManagerContextMap.TestSuitesMap = testSuiteContextListToMap(propertyManagerContext.TestSuiteExecutionsV3)
+ functionalContextMap.PropertyManagersMap[propertyManagerContext.PropertyId] = propertyManagerContextMap
- functionalContextMap.TestSuitesMap = testSuiteContextListToMap(functionalContext.TestSuites)
+ functionalContextMap.TestSuitesMap = testSuiteContextListToMap(testSuiteExecutions)
return &functionalContextMap, nil
}
-func testSuiteContextListToMap(testSuiteContexts []TestSuiteContext) map[int]TestSuiteContextMap {
+func testSuiteContextListToMap(testSuiteExecutionV3s []TestSuiteExecutionV3) map[int]TestSuiteContextMap {
testSuitesContextMap := make(map[int]TestSuiteContextMap)
- for _, testSuiteContext := range testSuiteContexts {
+ for _, testSuiteContext := range testSuiteExecutionV3s {
var testSuiteContextMap TestSuiteContextMap
- err := copier.Copy(&testSuiteContextMap, &testSuiteContext)
+ err := copier.Copy(&testSuiteContextMap, &testSuiteContext.TestSuiteContext)
if err != nil {
return nil
}
- testSuiteContextMap.TestCasesMap = testCasesListToMap(testSuiteContext.TestCases)
+ testSuiteContextMap.TestCasesMap = testCasesListToMap(testSuiteContext.TestCaseExecutionsV3)
testSuitesContextMap[testSuiteContext.TestSuiteId] = testSuiteContextMap
}
return testSuitesContextMap
}
-func testCasesListToMap(testCases []TestCase) map[int]TestCase {
+func testCasesListToMap(testCases []TestCaseExecutionV3) map[int]TestCase {
testCasesMap := make(map[int]TestCase)
for _, testCase := range testCases {
- testCasesMap[testCase.TestCaseId] = testCase
+ testCasesMap[testCase.TestCaseId] = testCase.TestCaseContext
}
return testCasesMap
}
@@ -66,13 +66,11 @@ func GetTestRunStats(testRun TestRun) (ResultStats, map[int]ResultStats) {
resultStats := ResultStats{}
tsxResultStatsMap := make(map[int]ResultStats)
- for _, cvx := range testRun.Functional.ConfigVersionExecutions {
- cvxResultStats := getConfigVersionExecutionStats(cvx, tsxResultStatsMap)
- addResultStats(&resultStats, &cvxResultStats)
-
- }
+ pmx := testRun.Functional.PropertyManagerExecution
+ pmxResultStats := getPropertyManagerExecutionStats(pmx, tsxResultStatsMap)
+ addResultStats(&resultStats, &pmxResultStats)
- for _, tsx := range testRun.Functional.TestSuiteExecutions {
+ for _, tsx := range testRun.Functional.TestSuiteExecutionsV3 {
tsxResultStats := getTestSuiteExecutionStats(tsx)
addResultStats(&resultStats, &tsxResultStats)
tsxResultStatsMap[tsx.TestSuiteExecutionId] = tsxResultStats
@@ -81,7 +79,17 @@ func GetTestRunStats(testRun TestRun) (ResultStats, map[int]ResultStats) {
return resultStats, tsxResultStatsMap
}
-func getTestCaseExecutionsStats(testCaseExecutions []TestCaseExecutionV2) ResultStats {
+func getPropertyManagerExecutionStats(pmExecution PropertyManagerExecution, tsxResultStatsMap map[int]ResultStats) ResultStats {
+ resultStats := ResultStats{}
+ for _, tsx := range pmExecution.TestSuiteExecutionsV3 {
+ tsxResultStats := getTestSuiteExecutionStats(tsx)
+ addResultStats(&resultStats, &tsxResultStats)
+ tsxResultStatsMap[tsx.TestSuiteExecutionId] = tsxResultStats
+ }
+ return resultStats
+}
+
+func getTestCaseExecutionsStats(testCaseExecutions []TestCaseExecutionV3) ResultStats {
resultStats := ResultStats{}
for _, tcx := range testCaseExecutions {
resultStats.TotalTestCasesCount += 1
@@ -98,18 +106,8 @@ func getTestCaseExecutionsStats(testCaseExecutions []TestCaseExecutionV2) Result
return resultStats
}
-func getTestSuiteExecutionStats(testSuiteExecution TestSuiteExecution) ResultStats {
- resultStats := getTestCaseExecutionsStats(testSuiteExecution.TestCaseExecutionV2)
- return resultStats
-}
-
-func getConfigVersionExecutionStats(configVersionExecution ConfigVersionExecution, tsxResultStatsMap map[int]ResultStats) ResultStats {
- resultStats := ResultStats{}
- for _, tsx := range configVersionExecution.TestSuiteExecutions {
- tsxResultStats := getTestSuiteExecutionStats(tsx)
- addResultStats(&resultStats, &tsxResultStats)
- tsxResultStatsMap[tsx.TestSuiteExecutionId] = tsxResultStats
- }
+func getTestSuiteExecutionStats(testSuiteExecution TestSuiteExecutionV3) ResultStats {
+ resultStats := getTestCaseExecutionsStats(testSuiteExecution.TestCaseExecutionsV3)
return resultStats
}
@@ -120,9 +118,9 @@ func addResultStats(destResultStats *ResultStats, resultStats *ResultStats) {
destResultStats.SystemErrorTestCasesCount += resultStats.SystemErrorTestCasesCount
}
-func PrintTestResult(cmd *cobra.Command, testRun *TestRun, testRunContext *TestRunContext) {
+func PrintTestResult(cmd *cobra.Command, testRun *TestRun) {
testRunStats, tsxResultStatsMap := GetTestRunStats(*testRun)
- functionalContextMap, err := GetFunctionalContextMap(testRunContext)
+ functionalContextMap, err := GetFunctionalContextMap(testRun)
if err != nil {
AbortForCommand(cmd, err)
}
@@ -140,40 +138,24 @@ func PrintTestResult(cmd *cobra.Command, testRun *TestRun, testRunContext *TestR
printLabelAndValue(LabelTargetEnvironment, CamelToTitle(testRun.TargetEnvironment))
fmt.Println()
- for i, configVersionExecution := range testRun.Functional.ConfigVersionExecutions {
- PrintConfigVersionExecution(cmd, configVersionExecution, functionalContextMap.ConfigVersionsMap, tsxResultStatsMap)
- if i < len(testRun.Functional.ConfigVersionExecutions)-1 {
- fmt.Println(SeparateLine)
- }
- }
+ propertyManagerExecution := testRun.Functional.PropertyManagerExecution
+ PrintPropertyManagerExecution(cmd, propertyManagerExecution, functionalContextMap.PropertyManagersMap, tsxResultStatsMap)
- for i, testSuiteExecution := range testRun.Functional.TestSuiteExecutions {
+ for i, testSuiteExecution := range testRun.Functional.TestSuiteExecutionsV3 {
PrintTestSuiteExecution(cmd, testSuiteExecution, functionalContextMap.TestSuitesMap, tsxResultStatsMap)
- if i < len(testRun.Functional.TestSuiteExecutions)-1 {
+ if i < len(testRun.Functional.TestSuiteExecutionsV3)-1 {
fmt.Println(SeparateLine)
}
}
- if testRun.Functional.TestCaseExecutionV3.TestRequest.TestRequestUrl != Empty {
+ if testRun.Functional.TestCaseExecution.TestRequest.TestRequestUrl != Empty {
log.Debug("Printing result for single test case execution!!!")
PrintTestCaseExecution(testRun)
}
}
-func PrintConfigVersionExecution(cmd *cobra.Command, configVersionExecution ConfigVersionExecution, configVersionsContextMap map[int]ConfigVersionContextMap, tsxResultStatsMap map[int]ResultStats) {
- propertyVersion := configVersionsContextMap[configVersionExecution.ConfigVersionId]
- fmt.Printf("%s: %s v%d\n\n", bold(LabelPropertyVersion), propertyVersion.PropertyName, propertyVersion.PropertyVersion)
-
- for i, tsx := range configVersionExecution.TestSuiteExecutions {
- PrintTestSuiteExecution(cmd, tsx, propertyVersion.TestSuitesMap, tsxResultStatsMap)
- if i < len(configVersionExecution.TestSuiteExecutions)-1 {
- fmt.Println(SeparateLine)
- }
- }
-}
-
-func PrintTestSuiteExecution(cmd *cobra.Command, testSuiteExecution TestSuiteExecution, testSuitesContextMap map[int]TestSuiteContextMap, tsxResultStatsMap map[int]ResultStats) {
+func PrintTestSuiteExecution(cmd *cobra.Command, testSuiteExecution TestSuiteExecutionV3, testSuitesContextMap map[int]TestSuiteContextMap, tsxResultStatsMap map[int]ResultStats) {
testSuite := testSuitesContextMap[testSuiteExecution.TestSuiteId]
tsxResultStats := tsxResultStatsMap[testSuiteExecution.TestSuiteExecutionId]
@@ -194,14 +176,14 @@ func PrintTestSuiteExecution(cmd *cobra.Command, testSuiteExecution TestSuiteExe
testSuiteHeader += strings.Join(testCaseResults, ", ")
fmt.Println(testSuiteHeader + "\n")
- for _, tcx := range testSuiteExecution.TestCaseExecutionV2 {
+ for _, tcx := range testSuiteExecution.TestCaseExecutionsV3 {
PrintTestCasesExecution(tcx, testSuite.TestCasesMap)
}
fmt.Println()
}
-func PrintTestCasesExecution(testCaseExecution TestCaseExecutionV2, testCasesMap map[int]TestCase) {
+func PrintTestCasesExecution(testCaseExecution TestCaseExecutionV3, testCasesMap map[int]TestCase) {
testCase := testCasesMap[testCaseExecution.TestCaseId]
if testCase.ClientProfile.IpVersion == Ipv4 {
@@ -241,9 +223,20 @@ func PrintTestCasesExecution(testCaseExecution TestCaseExecutionV2, testCasesMap
fmt.Println()
}
+func PrintPropertyManagerExecution(cmd *cobra.Command, propertyManagerExecution PropertyManagerExecution, propertyManagersContextMap map[int]PropertyManagerContextMap, tsxResultStatsMap map[int]ResultStats) {
+ propertyVersion := propertyManagersContextMap[propertyManagerExecution.PropertyId]
+
+ for i, tsx := range propertyManagerExecution.TestSuiteExecutionsV3 {
+ PrintTestSuiteExecution(cmd, tsx, propertyVersion.TestSuitesMap, tsxResultStatsMap)
+ if i < len(propertyManagerExecution.TestSuiteExecutionsV3)-1 {
+ fmt.Println(SeparateLine)
+ }
+ }
+}
+
func PrintTestCaseExecution(testRun *TestRun) {
- testCaseExecution := &testRun.Functional.TestCaseExecutionV3
+ testCaseExecution := &testRun.Functional.TestCaseExecution
if testCaseExecution.ClientProfile.IpVersion == Ipv4 {
fmt.Println(testCaseExecution.TestRequest.TestRequestUrl + SeparatePipe + bold(LabelIPv4))
} else {
@@ -375,7 +368,7 @@ func PrintTestSuitesTable(cmd *cobra.Command, testSuites []TestSuiteV3) {
propertyVersionStr = fmt.Sprintf("%s v%d", ts.Configs.PropertyManager.PropertyName, ts.Configs.PropertyManager.PropertyVersion)
}
tsId := strconv.Itoa(ts.TestSuiteId)
- tcCount := strconv.Itoa(ts.TestCaseCount)
+ tcCount := strconv.Itoa(ts.ExecutableTestCaseCount)
row := []string{tsId, ts.TestSuiteName, ts.TestSuiteDescription, propertyVersionStr, tcCount}
contents[i] = row
diff --git a/internal/service.go b/internal/service.go
index b43ca68..c3da906 100644
--- a/internal/service.go
+++ b/internal/service.go
@@ -4,7 +4,6 @@ import (
"fmt"
"strconv"
"strings"
- "sync"
"time"
log "github.com/sirupsen/logrus"
@@ -24,7 +23,7 @@ func NewService(api ApiClient, cmd *cobra.Command, jsonOutput bool) *Service {
func (svc Service) GetTestSuites(propertyName, propVersion, user, searchString string) []TestSuiteV3 {
spinner := NewSpinner(GetServiceMessage(svc.cmd, MessageTypeSpinner, "", "getTestSuite"), !svc.jsonOutput).Start()
- testSuitesV3, err := svc.api.GetTestSuitesV3(propertyName, propVersion, user)
+ testSuitesV3, err := svc.api.GetTestSuitesV3(propertyName, propVersion, user, true)
if err != nil {
spinner.StopWithFailure()
AbortForCommand(svc.cmd, err)
@@ -43,7 +42,7 @@ func (svc Service) GetTestSuites(propertyName, propVersion, user, searchString s
func (svc Service) ImportTestSuites(testSuiteImport TestSuiteV3) {
spinner := NewSpinner(GetServiceMessage(svc.cmd, MessageTypeSpinner, "", "importTestSuite"), !svc.jsonOutput).Start()
- svc.setClientTypeAndRequestMethod(&testSuiteImport)
+ svc.setClientAndRequestMethod(&testSuiteImport)
testSuiteImportResponseV3, err := svc.api.ImportTestSuite(testSuiteImport)
if err != nil {
@@ -57,7 +56,7 @@ func (svc Service) ImportTestSuites(testSuiteImport TestSuiteV3) {
}
PrintViewTestSuite(svc.cmd, []TestSuiteV3{testSuiteImportResponseV3.Success}, testSuiteImportResponseV3.Success.TestSuiteName)
- printLabelAndValue(GetServiceMessage(svc.cmd, MessageTypeDisplay, "", "testCasesAdded"), testSuiteImportResponseV3.Success.TestCaseCount)
+ printLabelAndValue(GetServiceMessage(svc.cmd, MessageTypeDisplay, "", "testCasesAdded"), testSuiteImportResponseV3.Success.ExecutableTestCaseCount)
if testSuiteImportResponseV3.Failure.TestCases != nil {
PrintError("\n" + GetServiceMessage(svc.cmd, MessageTypeDisplay, "", "importTSTestCaseFailed") + "\n")
@@ -72,7 +71,7 @@ func (svc Service) ImportTestSuites(testSuiteImport TestSuiteV3) {
func (svc Service) ManageTestSuites(testSuiteManage TestSuiteV3) {
spinner := NewSpinner(GetServiceMessage(svc.cmd, MessageTypeSpinner, "", "manageTestSuite"), !svc.jsonOutput).Start()
- svc.setClientTypeAndRequestMethod(&testSuiteManage)
+ svc.setClientAndRequestMethod(&testSuiteManage)
testSuiteManageResponseV3, err := svc.api.ManageTestSuite(testSuiteManage, testSuiteManage.TestSuiteId)
if err != nil {
@@ -172,7 +171,7 @@ func (svc Service) RestoreTestSuiteById(id string) *TestSuiteV3 {
}
-func (svc Service) GetTestSuitesByIdOrName(id, name, subResource string, exactMatch, shouldMatchDescription bool) []TestSuiteV3 {
+func (svc Service) GetTestSuitesByIdOrName(id, name, subResource string, exactMatch, shouldMatchDescription, includeDeleted bool) []TestSuiteV3 {
spinner := NewSpinner(GetServiceMessage(svc.cmd, MessageTypeSpinner, "", "getTestSuite"), !svc.jsonOutput).Start()
@@ -188,7 +187,7 @@ func (svc Service) GetTestSuitesByIdOrName(id, name, subResource string, exactMa
return []TestSuiteV3{*testSuite}
} else {
- testSuitesV3, err := svc.api.GetTestSuitesV3("", "", "")
+ testSuitesV3, err := svc.api.GetTestSuitesV3("", "", "", includeDeleted)
if err != nil {
spinner.StopWithFailure()
AbortForCommandWithSubResource(svc.cmd, err, subResource, Read)
@@ -199,9 +198,9 @@ func (svc Service) GetTestSuitesByIdOrName(id, name, subResource string, exactMa
}
}
-func (svc Service) GetSingleTestSuiteByIdOrName(id, name, subResource string) *TestSuiteV3 {
+func (svc Service) GetSingleTestSuiteByIdOrName(id, name, subResource string, includeDeleted bool) *TestSuiteV3 {
- testSuites := svc.GetTestSuitesByIdOrName(id, name, subResource, true, false)
+ testSuites := svc.GetTestSuitesByIdOrName(id, name, subResource, true, false, includeDeleted)
if len(testSuites) == 1 {
return &testSuites[0]
@@ -280,7 +279,7 @@ func (svc Service) GetTestSuiteOrTestSuiteDetailsWithChildObjects(id, name strin
var testSuiteDetailsWithChildObjects = TestSuiteV3{}
if name != "" {
- testSuites := svc.GetTestSuitesByIdOrName(id, name, Empty, false, false)
+ testSuites := svc.GetTestSuitesByIdOrName(id, name, Empty, false, false, true)
if len(testSuites) > 1 {
return testSuites, testSuiteDetailsWithChildObjects
}
@@ -309,7 +308,7 @@ func (svc Service) ViewTestSuite(id string, name string, groupBy string) {
PrintJsonAndExit(testSuiteDetailsWithChildObjects)
} else {
PrintViewTestSuite(svc.cmd, []TestSuiteV3{TestSuiteV3(testSuiteDetailsWithChildObjects)}, name)
- if testSuiteDetailsWithChildObjects.TestCaseCount == len(testSuiteDetailsWithChildObjects.TestCases) {
+ if testSuiteDetailsWithChildObjects.ExecutableTestCaseCount == len(testSuiteDetailsWithChildObjects.TestCases) {
areAllTestCasesIncluded = true
}
PrintTestCases(svc.cmd, testSuiteDetailsWithChildObjects.TestCases, areAllTestCasesIncluded, groupBy)
@@ -319,7 +318,7 @@ func (svc Service) ViewTestSuite(id string, name string, groupBy string) {
func (svc Service) RemoveTestSuiteByIdOrName(id string, name string) {
- testSuites := svc.GetTestSuitesByIdOrName(id, name, Empty, false, false)
+ testSuites := svc.GetTestSuitesByIdOrName(id, name, Empty, false, false, true)
if len(testSuites) == 1 {
testSuiteId := strconv.Itoa(testSuites[0].TestSuiteId)
@@ -341,7 +340,7 @@ func (svc Service) RemoveTestSuiteByIdOrName(id string, name string) {
func (svc Service) RestoreTestSuiteByIdOrName(id string, name string) {
- testSuites := svc.GetTestSuitesByIdOrName(id, name, Empty, false, false)
+ testSuites := svc.GetTestSuitesByIdOrName(id, name, Empty, false, false, true)
if len(testSuites) == 1 {
testSuiteId := strconv.Itoa(testSuites[0].TestSuiteId)
testSuite := svc.RestoreTestSuiteById(testSuiteId)
@@ -417,25 +416,13 @@ func (svc Service) RunTest(runTestUsing, testSuiteId, testSuiteName, propertyNam
case RunTestUsingTestSuiteName:
testRun = svc.findAndRunTestSuite(testSuiteName, targetEnvironment, runTestUsing)
case RunTestUsingPropertyVersion:
- testRun = svc.findAndRunPropertyVersion(propertyName, propVersion, targetEnvironment, runTestUsing)
+ testRun = svc.runPropertyVersion(propertyName, propVersion, targetEnvironment, runTestUsing)
case RunTestUsingSingleTestCase:
testRun = svc.runTestCase(url, condition, ipVersion, addHeader, modifyHeader, filterHeader, targetEnvironment, runTestUsing)
case RunTestUsingJsonInput:
testRun = svc.startTestRun(testRunRequestFromJson, runTestUsing)
}
- // Fetch test run context
- // TODO: Add retries for all API calls
- var testRunContext *TestRunContext
- go func() {
- trContext, err := svc.api.GetTestRunContext(testRun.TestRunId)
- if err != nil {
- AbortForCommandWithSubResource(svc.cmd, err, TestRunResource, Read)
- return
- }
- testRunContext = trContext
- }()
-
// Wait for test run results
testResult, err := svc.waitForTestRunCompletion(testRun.TestRunId, runTestUsing)
if err != nil {
@@ -443,11 +430,12 @@ func (svc Service) RunTest(runTestUsing, testSuiteId, testSuiteName, propertyNam
}
// Print test run result
- PrintTestResult(svc.cmd, testResult, testRunContext)
+ PrintTestResult(svc.cmd, testResult)
+
}
func (svc Service) findAndRunTestSuite(testSuiteName, targetEnvironment string, runTestUsing string) *TestRun {
- testSuite := svc.GetSingleTestSuiteByIdOrName("", testSuiteName, TestSuiteResource)
+ testSuite := svc.GetSingleTestSuiteByIdOrName("", testSuiteName, TestSuiteResource, false)
if testSuite == nil {
AbortWithExitCode(fmt.Sprintf(GetMessageForKey(svc.cmd, "testSuiteNameNotFound")+"\n", testSuiteName), ExitStatusCode0)
}
@@ -455,26 +443,15 @@ func (svc Service) findAndRunTestSuite(testSuiteName, targetEnvironment string,
return svc.runTestSuiteWithId(testSuite.TestSuiteId, targetEnvironment, runTestUsing)
}
-func (svc Service) runTestSuiteWithId(testSuiteId int, targetEnvironment string, runTestUsing string) *TestRun {
- testCaseIds := svc.getAssociatedTestCaseIdsForTestSuiteId(testSuiteId, runTestUsing)
-
- if len(testCaseIds) == 0 {
- AbortWithExitCode(GetMessageForKey(svc.cmd, "testCasesNotFound")+"\n", ExitStatusCode0)
- }
-
- return svc.runTestSuite(testSuiteId, testCaseIds, targetEnvironment, runTestUsing)
-}
-
-func (svc Service) runTestSuite(testSuiteId int, testCaseIds []int, environment string, runTestUsing string) *TestRun {
+func (svc Service) runTestSuiteWithId(testSuiteId int, environment string, runTestUsing string) *TestRun {
testRun := TestRun{
SendEmailOnCompletion: false,
TargetEnvironment: environment,
Functional: FunctionalTestRun{
- TestSuiteExecutions: []TestSuiteExecution{
+ TestSuiteExecutionsV3: []TestSuiteExecutionV3{
{
- TestSuiteId: testSuiteId,
- TestCaseExecutionV2: getTestCaseExecutions(testCaseIds),
+ TestSuiteId: testSuiteId,
},
},
},
@@ -483,102 +460,15 @@ func (svc Service) runTestSuite(testSuiteId int, testCaseIds []int, environment
return svc.startTestRun(testRun, runTestUsing)
}
-func (svc Service) findAndRunPropertyVersion(propertyName, propVersion, targetEnvironment string, runTestUsing string) *TestRun {
-
- config := svc.findPropertyVersion(propertyName, propVersion, runTestUsing)
-
- testSuites := svc.findTestSuitesForPropertyVersion(propertyName, propVersion, runTestUsing)
- if len(testSuites) == 0 {
- AbortWithExitCode(GetMessageForKey(svc.cmd, PropertyVersionTestSuitesNotFound)+"\n", ExitStatusCode0)
- }
-
- var testSuiteIds []int
- for _, testSuite := range testSuites {
- testSuiteIds = append(testSuiteIds, testSuite.TestSuiteId)
- }
-
- testSuiteExecutionsChan := make(chan TestSuiteExecution, len(testSuiteIds))
-
- var wg sync.WaitGroup
- wg.Add(len(testSuiteIds))
- for _, testSuiteId := range testSuiteIds {
- go func(testSuiteId int) {
- defer wg.Done()
- testCaseIds := svc.getAssociatedTestCaseIdsForTestSuiteId(testSuiteId, runTestUsing)
- testCaseExecutions := getTestCaseExecutions(testCaseIds)
- testSuiteExecution := TestSuiteExecution{
- TestSuiteId: testSuiteId,
- TestCaseExecutionV2: testCaseExecutions,
- }
-
- // Ignore test suites that don't have any test cases
- if len(testCaseExecutions) > 0 {
- testSuiteExecutionsChan <- testSuiteExecution
- }
- }(testSuiteId) // Fetch test suites' associated test cases in parallel
- }
-
- wg.Wait()
- close(testSuiteExecutionsChan)
-
- var testSuiteExecutions []TestSuiteExecution
- for testSuiteExecution := range testSuiteExecutionsChan {
- testSuiteExecutions = append(testSuiteExecutions, testSuiteExecution)
- }
-
- if len(testSuiteExecutions) == 0 {
- AbortWithExitCode(GetMessageForKey(svc.cmd, "noTestCases")+"\n", ExitStatusCode0)
- }
-
- return svc.runConfigVersion(config.ConfigVersionId, testSuiteExecutions, targetEnvironment, runTestUsing)
-}
-
-func (svc Service) findPropertyVersion(propertyName string, propVersion string, runTestUsing string) *ConfigVersion {
-
- spinner := NewSpinner(GetServiceMessage(svc.cmd, MessageTypeTestCmdSpinner, runTestUsing, "findPropertyVersion"), !svc.jsonOutput).Start()
- propertyVersions, err := svc.api.GetConfigVersions()
- if err != nil {
- spinner.StopWithFailure()
- AbortForCommandWithSubResource(svc.cmd, err, PropertyVersionsResource, Read)
- }
-
- cleanedLowerCasePropertyName := strings.TrimSpace(strings.ToLower(propertyName))
- versionNumber, _ := strconv.Atoi(propVersion)
- for _, propertyVersion := range propertyVersions {
- if cleanedLowerCasePropertyName == strings.TrimSpace(strings.ToLower(propertyVersion.PropertyName)) && versionNumber == propertyVersion.PropertyVersion {
- spinner.StopWithSuccess()
- return &propertyVersion
- }
- }
-
- spinner.StopWithFailure()
- AbortWithExitCode(GetMessageForKey(svc.cmd, PropertyVersionNotFound)+"\n", ExitStatusCode0)
- return nil
-}
-
-func (svc Service) findTestSuitesForPropertyVersion(propertyName string, propVersion string, runTestUsing string) []TestSuiteV3 {
- spinner := NewSpinner(GetServiceMessage(svc.cmd, MessageTypeTestCmdSpinner, runTestUsing, "findTestSuite"), !svc.jsonOutput).Start()
- testSuites, err := svc.api.GetTestSuitesV3(propertyName, propVersion, "")
- if err != nil {
- spinner.StopWithFailure()
- AbortForCommandWithSubResource(svc.cmd, err, TestSuiteResource, Read)
- }
-
- spinner.StopWithSuccess()
- return testSuites
-}
-
-func (svc Service) runConfigVersion(configVersionId int, testSuiteExecutions []TestSuiteExecution, environment string, runTestUsing string) *TestRun {
-
+func (svc Service) runPropertyVersion(propertyName, propVersion, environment string, runTestUsing string) *TestRun {
+ propertyVersion, _ := strconv.Atoi(propVersion)
testRun := TestRun{
SendEmailOnCompletion: false,
TargetEnvironment: environment,
Functional: FunctionalTestRun{
- ConfigVersionExecutions: []ConfigVersionExecution{
- {
- ConfigVersionId: configVersionId,
- TestSuiteExecutions: testSuiteExecutions,
- },
+ PropertyManagerExecution: PropertyManagerExecution{
+ PropertyName: propertyName,
+ PropertyVersion: propertyVersion,
},
},
}
@@ -589,16 +479,16 @@ func (svc Service) runConfigVersion(configVersionId int, testSuiteExecutions []T
func (svc Service) runTestCase(url, condition, ipVersion string, addHeader, modifyHeader,
filterHeader []string, targetEnvironment string, runTestUsing string) *TestRun {
- var clientProfile = ClientProfile{IpVersion: Ipv4, ClientType: Browser}
+ var clientProfile = ClientProfile{IpVersion: Ipv4, Client: Chrome}
if strings.ToUpper(ipVersion) == "V6" {
- clientProfile = ClientProfile{IpVersion: Ipv6, ClientType: Browser}
+ clientProfile = ClientProfile{IpVersion: Ipv6, Client: Chrome}
}
testRun := TestRun{
SendEmailOnCompletion: false,
TargetEnvironment: targetEnvironment,
Functional: FunctionalTestRun{
- TestCaseExecutionV3: TestCaseExecutionV3{
+ TestCaseExecution: TestCaseExecution{
TestRequest: TestRequest{
TestRequestUrl: url,
RequestMethod: Get,
@@ -615,24 +505,6 @@ func (svc Service) runTestCase(url, condition, ipVersion string, addHeader, modi
return svc.startTestRun(testRun, runTestUsing)
}
-func (svc Service) getAssociatedTestCaseIdsForTestSuiteId(testSuiteId int, runTestUsing string) []int {
- spinner := NewSpinner(GetServiceMessage(svc.cmd, MessageTypeTestCmdSpinner, runTestUsing, "findTestCases"), !svc.jsonOutput).Start()
- testCases, err := svc.api.GetV3AssociatedTestCasesForTestSuite(testSuiteId)
- if err != nil {
- spinner.StopWithFailure()
- AbortForCommandWithSubResource(svc.cmd, err, TestCaseResource, Read)
- }
-
- spinner.StopWithSuccess()
-
- var testCaseIds []int
- for _, testCase := range testCases.TestCases {
- testCaseIds = append(testCaseIds, testCase.TestCaseId)
- }
-
- return testCaseIds
-}
-
func (svc Service) startTestRun(testRun TestRun, runTestUsing string) *TestRun {
spinner := NewSpinner(GetServiceMessage(svc.cmd, MessageTypeTestCmdSpinner, runTestUsing, "startTestRun"), !svc.jsonOutput).Start()
createdTestRun, err := svc.api.SubmitTestRun(testRun)
@@ -683,18 +555,6 @@ func (svc Service) waitForTestRunCompletion(testRunId int, runTestUsing string)
return nil, CliErrorWithMessage(CliErrorMessageTestRunStatus)
}
-func getTestCaseExecutions(testCaseIds []int) []TestCaseExecutionV2 {
- var testCaseExecutions []TestCaseExecutionV2
-
- for _, testCaseId := range testCaseIds {
- testCaseExecutions = append(testCaseExecutions, TestCaseExecutionV2{
- TestCaseId: testCaseId,
- })
- }
-
- return testCaseExecutions
-}
-
func constructTestCase(url string, addHeader, modifyHeader, filterHeader []string, condition, ipVersion string) TestCase {
var (
testCase TestCase
@@ -715,10 +575,10 @@ func constructTestCase(url string, addHeader, modifyHeader, filterHeader []strin
}
clientProfileId = 2 // Use default IPv4
- clientProfile = ClientProfile{IpVersion: Ipv4, ClientType: Browser}
+ clientProfile = ClientProfile{IpVersion: Ipv4, Client: Chrome}
if strings.ToUpper(ipVersion) == "V6" {
clientProfileId = 1
- clientProfile = ClientProfile{IpVersion: Ipv6, ClientType: Browser}
+ clientProfile = ClientProfile{IpVersion: Ipv6, Client: Chrome}
}
testCase = TestCase{
@@ -894,13 +754,13 @@ func (svc Service) GenerateTestSuite(propertyName string, propVersion int, urls
PrintJsonAndExit(generatedTs)
}
-// setClientTypeAndRequestMethod set ClientType and RequestMethod to defaults
-func (svc Service) setClientTypeAndRequestMethod(testSuiteV3 *TestSuiteV3) {
+// setClientAndRequestMethod set Client and RequestMethod to defaults
+func (svc Service) setClientAndRequestMethod(testSuiteV3 *TestSuiteV3) {
if testSuiteV3 != nil && len(testSuiteV3.TestCases) > 0 {
var updatedTestCases []TestCase
for _, tc := range testSuiteV3.TestCases {
tc.TestRequest.RequestMethod = Get
- tc.ClientProfile.ClientType = Browser
+ tc.ClientProfile.Client = Chrome
updatedTestCases = append(updatedTestCases, tc)
}
testSuiteV3.TestCases = updatedTestCases
diff --git a/internal/types.go b/internal/types.go
index bd8e204..7cd74f1 100644
--- a/internal/types.go
+++ b/internal/types.go
@@ -12,7 +12,7 @@ type ClientProfile struct {
GeoLocation string `json:"geoLocation,omitempty"`
IpVersion string `json:"ipVersion"`
Browser BrowserInfo `json:"browser,omitempty"`
- ClientType string `json:"clientType,omitempty"`
+ Client string `json:"client,omitempty"`
}
type RequestHeader struct {
@@ -86,21 +86,21 @@ type TestSuiteImportFailure struct {
}
type TestSuiteV3 struct {
- CreatedBy string `json:"createdBy,omitempty"`
- CreatedDate string `json:"createdDate,omitempty"`
- ModifiedBy string `json:"modifiedBy,omitempty"`
- ModifiedDate string `json:"modifiedDate,omitempty"`
- DeletedBy string `json:"deletedBy,omitempty"`
- DeletedDate string `json:"deletedDate,omitempty"`
- TestSuiteId int `json:"testSuiteId,omitempty"`
- TestSuiteName string `json:"testSuiteName"`
- TestSuiteDescription string `json:"testSuiteDescription,omitempty"`
- IsLocked bool `json:"isLocked"`
- IsStateful bool `json:"isStateful"`
- TestCaseCount int `json:"testCaseCount"`
- Configs AkamaiConfigs `json:"configs,omitempty"`
- TestCases []TestCase `json:"testCases,omitempty"`
- Variables []Variable `json:"variables,omitempty"`
+ CreatedBy string `json:"createdBy,omitempty"`
+ CreatedDate string `json:"createdDate,omitempty"`
+ ModifiedBy string `json:"modifiedBy,omitempty"`
+ ModifiedDate string `json:"modifiedDate,omitempty"`
+ DeletedBy string `json:"deletedBy,omitempty"`
+ DeletedDate string `json:"deletedDate,omitempty"`
+ TestSuiteId int `json:"testSuiteId,omitempty"`
+ TestSuiteName string `json:"testSuiteName"`
+ TestSuiteDescription string `json:"testSuiteDescription,omitempty"`
+ IsLocked bool `json:"isLocked"`
+ IsStateful bool `json:"isStateful"`
+ ExecutableTestCaseCount int `json:"executableTestCaseCount"`
+ Configs AkamaiConfigs `json:"configs,omitempty"`
+ TestCases []TestCase `json:"testCases,omitempty"`
+ Variables []Variable `json:"variables,omitempty"`
}
type Variable struct {
@@ -114,7 +114,6 @@ type AkamaiConfigs struct {
}
type PropertyManager struct {
- ConfigVersionId int `json:"configVersionId,omitempty"`
PropertyId int `json:"propertyId,omitempty"`
PropertyName string `json:"propertyName,omitempty"`
PropertyVersion int `json:"propertyVersion"`
@@ -143,41 +142,43 @@ type TestRun struct {
}
type FunctionalTestRun struct {
- Status string `json:"status,omitempty"`
- TestSuiteExecutions []TestSuiteExecution `json:"testSuiteExecutions,omitempty"`
- ConfigVersionExecutions []ConfigVersionExecution `json:"configVersionExecutions,omitempty"`
- TestCaseExecutionV3 TestCaseExecutionV3 `json:"testCaseExecution,omitempty"`
+ Status string `json:"status,omitempty"`
+ TestSuiteExecutionsV3 []TestSuiteExecutionV3 `json:"testSuiteExecutions,omitempty"`
+ PropertyManagerExecution PropertyManagerExecution `json:"propertyManagerExecution,omitempty"`
+ TestCaseExecution TestCaseExecution `json:"testCaseExecution,omitempty"`
}
-type ConfigVersionExecution struct {
- ConfigVersionId int `json:"configVersionId"`
- Status string `json:"status,omitempty"`
- TestSuiteExecutions []TestSuiteExecution `json:"testSuiteExecutions"`
+type PropertyManagerExecution struct {
+ PropertyId int `json:"propertyId,omitempty"`
+ PropertyName string `json:"propertyName"`
+ PropertyVersion int `json:"propertyVersion"`
+ TestSuiteExecutionsV3 []TestSuiteExecutionV3 `json:"testSuiteExecutions,omitempty"`
}
-type TestSuiteExecution struct {
+type TestSuiteExecutionV3 struct {
TestSuiteId int `json:"testSuiteId"`
Status string `json:"status,omitempty"`
- TestCaseExecutionV2 []TestCaseExecutionV2 `json:"testCaseExecutions"`
- TestSuiteExecutionId int `json:"testSuiteExecutionId,omitempty"`
- SubmittedBy string `json:"submittedBy,omitempty"`
- SubmittedDate string `json:"submittedDate,omitempty"`
- CompletedDate string `json:"completedDate,omitempty"`
+ TestCaseExecutionsV3 []TestCaseExecutionV3 `json:"testCaseExecutions"`
+ TestSuiteContext TestSuiteV3
+ TestSuiteExecutionId int `json:"testSuiteExecutionId,omitempty"`
+ SubmittedBy string `json:"submittedBy,omitempty"`
+ SubmittedDate string `json:"submittedDate,omitempty"`
+ CompletedDate string `json:"completedDate,omitempty"`
}
-type TestCaseExecutionV2 struct {
+type TestCaseExecutionV3 struct {
TestCaseId int `json:"testCaseId"`
TestCaseExecutionId int `json:"testCaseExecutionId,omitempty"`
Status string `json:"status,omitempty"`
ConditionEvaluationResult ConditionEvaluationResult `json:"conditionEvaluationResult,omitempty"`
+ TestCaseContext TestCase `json:"testCaseContext,omitempty"`
Errors []ApiSubError `json:"errors,omitempty"`
- Order int `json:"order,omitempty"`
SubmittedBy string `json:"submittedBy,omitempty"`
SubmittedDate string `json:"submittedDate,omitempty"`
CompletedDate string `json:"completedDate,omitempty"`
}
-type TestCaseExecutionV3 struct {
+type TestCaseExecution struct {
TestRequest TestRequest `json:"testRequest"`
ClientProfile ClientProfile `json:"clientProfile,omitempty"`
Condition Condition `json:"condition"`
@@ -206,15 +207,15 @@ type TestRunContext struct {
}
type FunctionalContext struct {
- TestSuites []TestSuiteContext `json:"testSuites,omitempty"`
- TestCases []TestCase `json:"testCases,omitempty"`
- ConfigVersions []ConfigVersionContext `json:"configVersions,omitempty"`
+ TestSuites []TestSuiteContext `json:"testSuites,omitempty"`
+ TestCases []TestCase `json:"testCases,omitempty"`
+ PropertyManagers []PropertyManagerContext `json:"propertyManagers,omitempty"`
}
type FunctionalContextMap struct {
- TestSuitesMap map[int]TestSuiteContextMap
- TestCasesMap map[int]TestCase
- ConfigVersionsMap map[int]ConfigVersionContextMap
+ TestSuitesMap map[int]TestSuiteContextMap
+ TestCasesMap map[int]TestCase
+ PropertyManagersMap map[int]PropertyManagerContextMap
}
type TestSuiteContext struct {
@@ -226,13 +227,13 @@ type TestSuiteContextMap struct {
*TestSuite
TestCasesMap map[int]TestCase
}
-type ConfigVersionContext struct {
- *ConfigVersion
+type PropertyManagerContext struct {
+ *PropertyManager
TestSuites []TestSuiteContext `json:"testSuites,omitempty"`
}
-type ConfigVersionContextMap struct {
- *ConfigVersion
+type PropertyManagerContextMap struct {
+ *PropertyManager
TestSuitesMap map[int]TestSuiteContextMap
}
diff --git a/internal/validator.go b/internal/validator.go
index b569326..23644ca 100644
--- a/internal/validator.go
+++ b/internal/validator.go
@@ -284,7 +284,6 @@ func (validator Validator) UrlsFlagCheck(urls []string) {
AbortWithUsageAndMessageAndCode(validator.cmd, GetErrorMessageForFlag(validator.cmd, Invalid, "url"), ExitStatusCode2)
}
}
-
}
// Check if length of run test using list has more than one different king of flag.
diff --git a/main.go b/main.go
index 8cfd528..7c287de 100644
--- a/main.go
+++ b/main.go
@@ -6,7 +6,7 @@ import (
)
var (
- VERSION string = "0.1.1"
+ VERSION string = "0.2.0"
)
func main() {
diff --git a/scripts/build.sh b/scripts/build.sh
index 5fad615..5c612e2 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -30,20 +30,21 @@ check_version $1
mkdir -p build
-GOOS=darwin GOARCH=amd64 go build -o build/akamai-$COMMAND_NAME-$1-macamd64 .
-# shasum -a 256 build/akamai-$COMMAND_NAME-$1-macamd64 | awk '{print $1}' > build/akamai-$COMMAND_NAME-$1-macamd64.sig
+GOOS=linux GOARCH=386 go build -o build/akamai-$COMMAND_NAME-$1-linux386 .
+shasum -a 256 build/akamai-$COMMAND_NAME-$1-linux386 | awk '{print $1}' > build/akamai-$COMMAND_NAME-$1-linux386.sig
GOOS=linux GOARCH=amd64 go build -o build/akamai-$COMMAND_NAME-$1-linuxamd64 .
shasum -a 256 build/akamai-$COMMAND_NAME-$1-linuxamd64 | awk '{print $1}' > build/akamai-$COMMAND_NAME-$1-linuxamd64.sig
-GOOS=linux GOARCH=386 go build -o build/akamai-$COMMAND_NAME-$1-linux386 .
-shasum -a 256 build/akamai-$COMMAND_NAME-$1-linux386 | awk '{print $1}' > build/akamai-$COMMAND_NAME-$1-linux386.sig
+# Generate the signature for the below binaries from signed binaries and not from here, Use the commented script command to generate the signature
+GOOS=darwin GOARCH=amd64 go build -o build/akamai-$COMMAND_NAME-$1-macamd64 .
+# shasum -a 256 build/akamai-$COMMAND_NAME-$1-macamd64 | awk '{print $1}' > build/akamai-$COMMAND_NAME-$1-macamd64.sig
+
+GOOS=darwin GOARCH=arm64 go build -o build/akamai-$COMMAND_NAME-$1-macarm64 .
+# shasum -a 256 build/akamai-$COMMAND_NAME-$1-macarm64 | awk '{print $1}' > build/akamai-$COMMAND_NAME-$1-macarm64.sig
GOOS=windows GOARCH=386 go build -o build/akamai-$COMMAND_NAME-$1-windows386.exe .
# shasum -a 256 build/akamai-$COMMAND_NAME-$1-windows386.exe | awk '{print $1}' > build/akamai-$COMMAND_NAME-$1-windows386.exe.sig
GOOS=windows GOARCH=amd64 go build -o build/akamai-$COMMAND_NAME-$1-windowsamd64.exe .
-# shasum -a 256 build/akamai-$COMMAND_NAME-$1-windowsamd64.exe | awk '{print $1}' > build/akamai-$COMMAND_NAME-$1-windowsamd64.exe.sig
-
-GOOS=darwin GOARCH=arm64 go build -o build/akamai-$COMMAND_NAME-$1-macarm64 .
-shasum -a 256 build/akamai-$COMMAND_NAME-$1-macarm64 | awk '{print $1}' > build/akamai-$COMMAND_NAME-$1-macarm64.sig
\ No newline at end of file
+# shasum -a 256 build/akamai-$COMMAND_NAME-$1-windowsamd64.exe | awk '{print $1}' > build/akamai-$COMMAND_NAME-$1-windowsamd64.exe.sig
\ No newline at end of file