cog
1eb813a5 - Port concurrent predictions test to Go and consolidate curl command (#2632)

Commit
66 days ago
Port concurrent predictions test to Go and consolidate curl command (#2632) * Port concurrent predictions test to Go and consolidate curl command - Add TestConcurrentPredictions in integration-tests/concurrent/ package Tests parallel HTTP requests with graceful shutdown behavior - Consolidate curl/retry-curl into single curl command with built-in retry logic (10 attempts, 500ms delay) - Update 4 txtar tests to use simplified curl command - Remove Python test_concurrent_predictions and async-sleep-project fixture - Update README with Test Formats section explaining when Go tests are used instead of txtar (concurrent requests, PTY interaction) * Port interactive TTY test to Go and remove Python integration tests (#2634) * Port interactive TTY test to Go - Add TestInteractiveTTY and TestInteractiveTTYEchoCommand in integration-tests/pty/ package using github.com/creack/pty - Tests verify cog run works with interactive PTY sessions - Remove Python test_run_shell_with_with_interactive_tty - Update README to reflect PTY tests are now implemented * Remove Python integration tests - all ported to Go - Remove test-integration/ directory entirely - Remove tox integration environment - Update Makefile to consolidate test-integration-go into test-integration - Update CI workflow to remove Python integration test jobs - Update CONTRIBUTING.md, AGENTS.md, and README documentation - Update pyproject.toml to remove test-integration lint exclusions All integration tests now live in integration-tests/ using Go testscript. * Add CODEOWNERS to auto-request review from @replicate/cog --------- Co-authored-by: Mark Phelps <mphelps@cloudflare.com> * Replace COG_TEST_FAST with t.Short() for test skipping Replace custom COG_TEST_FAST environment variable with Go's standard testing.Short() mechanism across all tests. Changes: - Use t.Short() in concurrent_test.go instead of COG_TEST_FAST check - Remove custom [fast] condition from suite_test.go (testscript has built-in [short] support) - Replace [fast] with [short] in all .txtar test files - Update documentation in CONTRIBUTING.md, README.md, and design docs This aligns with Go testing conventions where -short flag is the standard way to skip slow tests. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Replace COG_TEST_FAST with t.Short() for test skipping Replace custom COG_TEST_FAST environment variable with Go's standard testing.Short() mechanism across all tests. Changes: - Use t.Short() in concurrent_test.go instead of COG_TEST_FAST check - Remove custom [fast] condition from suite_test.go (testscript has built-in [short] support) - Replace [fast] with [short] in all .txtar test files - Update documentation in CONTRIBUTING.md, README.md, and design docs This aligns with Go testing conventions where -short flag is the standard way to skip slow tests. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Simplify and modernize integration test code - Use http.StatusOK instead of magic number 200 - Use io.ReadAll instead of manual buffer loop in harness - Use strings.NewReader instead of bytes.NewBufferString - Use testing.Short() instead of COG_TEST_FAST env var in pty tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: quiet buildkit_progress to see failing tests Signed-off-by: Mark Phelps <mphelps@cloudflare.com> * fix: increase timeout and add polling for TestInteractiveTTY The test was failing in CI because the 5-second timeout wasn't long enough for Docker image builds when the cache is cold. In CI environments, pulling base images and building can take 20-60 seconds. Changes: - Add waitForOutput() helper that polls for expected output pattern - Increase timeout from 5s to 60s for bash prompt detection - Return early when bash prompt is detected (no need to wait full 60s) - Add explicit check for bash prompt pattern ':/src#' This makes the test: - Fast locally (returns in ~5s with warm cache) - Resilient in CI (up to 60s for cold cache builds) - More robust (waits for actual prompt, not arbitrary timeout) * fix: use dynamic port allocation in concurrent predictions test Fixed flaky test caused by hardcoded port 5555. In CI environments, this port could be in use by stale servers or other processes, causing predictions to go to the wrong server and return empty output. Now uses dynamic port allocation via net.Listen to get an available port, matching the pattern used in harness/harness.go. * ci: add Go module caching for integration tests Configure actions/setup-go to cache both root and integration-tests go.sum files to speed up dependency downloads in CI. * test: skip concurrent predictions test for coglet-alpha coglet-alpha has a known bug with concurrent async predictions that causes predictions to return empty output. Since this is in the released version, skip this test when COG_WHEEL=coglet-alpha. --------- Signed-off-by: Mark Phelps <mphelps@cloudflare.com> Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Author
Parents
Loading