diff --git a/keploy.yml b/keploy.yml new file mode 100755 index 0000000..6778c43 --- /dev/null +++ b/keploy.yml @@ -0,0 +1,83 @@ +path: "" +command: "" +port: 0 +proxyPort: 16789 +dnsPort: 26789 +debug: false +disableANSI: false +disableTele: false +inDocker: false +generateGithubActions: true +containerName: "" +networkName: "" +buildDelay: 30s +test: + selectedTests: {} + globalNoise: + global: {} + test-sets: {} + delay: 5 + apiTimeout: 5 + coverage: false + goCoverage: false + coverageReportPath: "" + ignoreOrdering: true + mongoPassword: "default@123" + language: "" + removeUnusedMocks: false +record: + recordTimer: 0s + filters: [] +configPath: "" +bypassRules: [] +cmdType: "native" +enableTesting: false +fallbackOnMiss: false +keployContainer: "keploy-v2" +keployNetwork: "keploy-network" + +# Example on using tests +#tests: +# filters: +# - path: "/user/app" +# urlMethods: ["GET"] +# headers: { +# "^asdf*": "^test" +# } +# host: "dc.services.visualstudio.com" +#Example on using stubs +#stubs: +# filters: +# - path: "/user/app" +# port: 8080 +# - port: 8081 +# - host: "dc.services.visualstudio.com" +# - port: 8081 +# host: "dc.services.visualstudio.com" +# path: "/user/app" + # +#Example on using globalNoise +#globalNoise: +# global: +# body: { +# # to ignore some values for a field, +# # pass regex patterns to the corresponding array value +# "url": ["https?://\S+", "http://\S+"], +# } +# header: { +# # to ignore the entire field, pass an empty array +# "Date": [], +# } +# # to ignore fields or the corresponding values for a specific test-set, +# # pass the test-set-name as a key to the "test-sets" object and +# # populate the corresponding "body" and "header" objects +# test-sets: +# test-set-1: +# body: { +# # ignore all the values for the "url" field +# "url": [] +# } +# header: { +# # we can also pass the exact value to ignore for a field +# "User-Agent": ["PostmanRuntime/7.34.0"] +# } diff --git a/main.go b/main.go index aca9fe6..4c5d647 100644 --- a/main.go +++ b/main.go @@ -48,7 +48,7 @@ func main() { *preRecPath, err = getAbsolutePath(*preRecPath) if err != nil { logger.Error("failed to get absolute path", zap.String("path", *preRecPath), zap.Error(err)) - return + os.Exit(1) } *preRecPath = filepath.Join(*preRecPath, "keploy") @@ -56,41 +56,41 @@ func main() { *testBenchPath, err = getAbsolutePath(*testBenchPath) if err != nil { logger.Error("failed to get absolute path", zap.String("path", *testBenchPath), zap.Error(err)) - return + os.Exit(1) } *testBenchPath = filepath.Join(*testBenchPath, "keploy") *configPath, err = getAbsolutePath(*configPath) if err != nil { logger.Error("failed to get absolute path", zap.String("path", *configPath), zap.Error(err)) - return + os.Exit(1) } - println("ConfigPath:", *configPath) + // get all the sessions tsets1, err := pkg.ReadSessionIndices(*preRecPath, logger) if err != nil { logger.Error("failed to read session indices", zap.String("path", *preRecPath), zap.Error(err)) - return + os.Exit(1) } tsets2, err := pkg.ReadSessionIndices(*testBenchPath, logger) if err != nil { logger.Error("failed to read session indices", zap.String("path", *testBenchPath), zap.Error(err)) - return + os.Exit(1) } // compare sessions, both should contain equal number of same sessions ok := compareSessions(tsets1, tsets2, logger) if !ok { logger.Error("sessions are not equal") - return + os.Exit(1) } sessions := tsets1 if len(sessions) == 0 { logger.Info("no sessions found") - return + os.Exit(0) } // initialize the test dbs