(cmd *cobra.Command)
| 351 | } |
| 352 | |
| 353 | func (c *CmdConfigurator) AddUncommonFlags(cmd *cobra.Command) { |
| 354 | switch cmd.Name() { |
| 355 | case "record": |
| 356 | cmd.Flags().Duration("record-timer", 0, "User provided time to record its application (e.g., \"5s\" for 5 seconds, \"1m\" for 1 minute)") |
| 357 | cmd.Flags().String("base-path", c.cfg.Record.BasePath, "Base URL to hit the server while recording the testcases") |
| 358 | cmd.Flags().Int("enable-sampling", c.cfg.Record.EnableSampling, "Enable sampling of testcases") |
| 359 | cmd.Flags().Lookup("enable-sampling").NoOptDefVal = "5" |
| 360 | cmd.Flags().Uint64("memory-limit", c.cfg.Record.MemoryLimit, "Memory limit for the keploy-agent container in MB") |
| 361 | cmd.Flags().String("metadata", c.cfg.Record.Metadata, "Metadata to be stored in config.yaml as key-value pairs (e.g., \"key1=value1,key2=value2\")") |
| 362 | cmd.Flags().String("tls-private-key-path", c.cfg.Record.TLSPrivateKeyPath, "Path to the private key for TLS connection") |
| 363 | cmd.Flags().Bool("capture-packets", c.cfg.Record.CapturePackets, "Capture raw network packets on the proxy ports and write a pcap file into each test-set directory") |
| 364 | cmd.Flags().Bool("opportunistic-tls-intercept", c.cfg.Record.OpportunisticTLSIntercept, "Sniff and hijack TLS connections in passthrough mode. Bytes flow verbatim between app and upstream until a TLS ClientHello is seen; the proxy then MITM-terminates both halves so the captured pcap is decryptable. Independent of --global-passthrough.") |
| 365 | // Advanced record-buffer tuning. Hidden from --help: only relevant |
| 366 | // when the operator already knows they need to bump these (saw |
| 367 | // per_conn_cap / channel_full drops in agent logs). Env vars |
| 368 | // KEPLOY_RECORD_MAX_MEMORY_PER_CONN and KEPLOY_RECORD_QUEUE_SIZE |
| 369 | // override these flags. |
| 370 | cmd.Flags().Uint64("max-memory-per-conn", c.cfg.Record.RecordBuffer.MaxMemoryPerConnection, "Bytes; per-connection recording buffer cap (default 64MiB). Bump if you see per_conn_cap drops.") |
| 371 | cmd.Flags().Int("queue-size", c.cfg.Record.RecordBuffer.QueueSize, "Number of chunk slots in the recording queue (default 1024). Bump if you see channel_full drops.") |
| 372 | _ = cmd.Flags().MarkHidden("max-memory-per-conn") |
| 373 | _ = cmd.Flags().MarkHidden("queue-size") |
| 374 | case "test": |
| 375 | cmd.Flags().StringSliceP("test-sets", "t", utils.Keys(c.cfg.Test.SelectedTests), "Testsets to run e.g. --testsets \"test-set-1, test-set-2\"") |
| 376 | cmd.Flags().String("host", c.cfg.Test.Host, "Custom host to replace the actual host in the testcases") |
| 377 | cmd.Flags().Uint32("port", c.cfg.Test.Port, "Custom http port to replace the actual port in the testcases") |
| 378 | cmd.Flags().Uint32("grpc-port", c.cfg.Test.GRPCPort, "Custom grpc port to replace the actual port in the testcases") |
| 379 | cmd.Flags().Uint32("sse-port", c.cfg.Test.SSEPort, "Custom SSE port to replace the actual port in the SSE testcases") |
| 380 | cmd.Flags().Uint64P("delay", "d", 5, "User provided time to run its application") |
| 381 | cmd.Flags().String("health-url", c.cfg.Test.HealthURL, "HTTP(S) URL polled before the first test is fired; first 2xx response proceeds immediately. Empty (default) preserves the fixed --delay behavior.") |
| 382 | cmd.Flags().Duration("health-poll-timeout", c.cfg.Test.HealthPollTimeout, "Ceiling for --health-url polling (e.g. 60s, 2m). If no 2xx is seen within this window, replay logs an info message and falls back to --delay.") |
| 383 | cmd.Flags().String("proto-file", c.cfg.Test.ProtoFile, "Path of main proto file") |
| 384 | cmd.Flags().String("proto-dir", c.cfg.Test.ProtoDir, "Path of the directory where all protos of a service are located") |
| 385 | cmd.Flags().StringArray("proto-include", c.cfg.Test.ProtoInclude, "Path of directories to be included while parsing import statements in proto files") |
| 386 | cmd.Flags().Uint64("api-timeout", c.cfg.Test.APITimeout, "User provided timeout for calling its application") |
| 387 | // Default mirrors keploy.yml's `disableMapping` (zero-value false → mapping |
| 388 | // enabled). Hardcoding the default to true silently disabled mapping-based |
| 389 | // mock filtering in test mode even when mappings.yaml was correctly |
| 390 | // produced during record, forcing replay onto the brittle timestamp-window |
| 391 | // path that loses tightly-spaced per-test mocks (listmonk-postgres |
| 392 | // pipeline 604, 3/38 tests with ~117 µs boundary races on the |
| 393 | // session-lookup query). determineMockingStrategy already falls back to |
| 394 | // timestamp-based filtering when no mappings.yaml exists, so flipping |
| 395 | // the default does not break recordings without mapping data. |
| 396 | cmd.Flags().Bool("disable-mapping", c.cfg.DisableMapping, "Disable mapping of testcases during test mode") |
| 397 | cmd.Flags().Bool("retry-passing-test", c.cfg.RetryPassing, "Enable retry passing test mode") |
| 398 | cmd.Flags().Bool("disableAutoHeaderNoise", c.cfg.Test.DisableAutoHeaderNoise, "Disable automatic noise for flaky headers (e.g. AWS SigV4: Authorization, X-Amz-Date, X-Amz-Security-Token) during mock matching") |
| 399 | cmd.Flags().String("mongo-password", c.cfg.Test.MongoPassword, "Authentication password for mocking MongoDB conn") |
| 400 | cmd.Flags().String("coverage-report-path", c.cfg.Test.CoverageReportPath, "Write a go coverage profile to the file in the given directory.") |
| 401 | cmd.Flags().VarP(&c.cfg.Test.Language, "language", "l", "Application programming language") |
| 402 | cmd.Flags().Bool("ignore-ordering", c.cfg.Test.IgnoreOrdering, "Ignore ordering of array in response") |
| 403 | cmd.Flags().Bool("skip-coverage", c.cfg.Test.SkipCoverage, "skip code coverage computation while running the test cases") |
| 404 | cmd.Flags().Bool("remove-unused-mocks", c.cfg.Test.RemoveUnusedMocks, "Clear the unused mocks for the passed test-sets") |
| 405 | cmd.Flags().Bool("fallBack-on-miss", c.cfg.Test.FallBackOnMiss, "[DEPRECATED] This flag is ignored. Replay is now always deterministic.") |
| 406 | _ = cmd.Flags().MarkDeprecated("fallBack-on-miss", "replay is now always deterministic; this flag is ignored") |
| 407 | cmd.Flags().String("jacoco-agent-path", c.cfg.Test.JacocoAgentPath, "Only applicable for test coverage for Java projects. You can override the jacoco agent jar by proving its path") |
| 408 | cmd.Flags().String("base-path", c.cfg.Test.BasePath, "Custom api basePath/origin to replace the actual basePath/origin in the testcases; App flag is ignored and app will not be started & instrumented when this is set since the application running on a different machine") |
| 409 | cmd.Flags().Bool("update-template", c.cfg.Test.UpdateTemplate, "Update the template with the result of the testcases.") |
| 410 | cmd.Flags().Bool("mocking", true, "enable/disable mocking for the testcases") |
no test coverage detected