Skip to content

Instantly share code, notes, and snippets.

@juanpabloaj
Last active June 21, 2025 18:38
Show Gist options
  • Save juanpabloaj/89d615f882c4452e7b48ed19f64b1057 to your computer and use it in GitHub Desktop.
Save juanpabloaj/89d615f882c4452e7b48ed19f64b1057 to your computer and use it in GitHub Desktop.
Running Integration Tests Without Docker in the Codex environment

Running Integration Tests Without Docker in the Codex environment

This guide explains how to execute the integration test suite in an environment where docker or docker-compose are unavailable. Ensure neither tool is installed before continuing. If either command prints a version number, use the container-based workflow instead.

# Check for docker and docker-compose
command -v docker && docker --version
command -v docker-compose && docker-compose --version

1. Install and Start PostgreSQL

sudo apt-get update
sudo apt-get install -y postgresql
sudo -u postgres /usr/lib/postgresql/16/bin/pg_ctl \
    -D /etc/postgresql/16/main \
    -l /tmp/postgresql.log start
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres';"
sudo -u postgres psql -c 'CREATE DATABASE "postgresTest";'

2. Download and Start Kafka with ZooKeeper

curl -L https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz -o kafka.tgz
 tar -xzf kafka.tgz
bash kafka_2.13-3.6.0/bin/zookeeper-server-start.sh -daemon kafka_2.13-3.6.0/config/zookeeper.properties
bash kafka_2.13-3.6.0/bin/kafka-server-start.sh -daemon kafka_2.13-3.6.0/config/server.properties

Create the required topics:

for t in test.topic.1 test.topic.2
 do
     kafka_2.13-3.6.0/bin/kafka-topics.sh --create --if-not-exists \
         --bootstrap-server localhost:9092 --topic "$t"
 done

3. Execute the Integration Tests

Navigate to the repository root and run the suite:

go test -failfast -tags=integration ./...

The tests should complete successfully if PostgreSQL and Kafka are running and the environment variables match your setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment