You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docker compose -f docker-compose.yml -f docker-compose.dev.yml run --rm -p 2416:2416 challenge-bypass golangci-lint run
@@ -34,3 +38,50 @@ generate-avro:
34
38
35
39
lint:
36
40
docker run --rm -v "$$(pwd):/app" --workdir /app golangci/golangci-lint:v2.1.6 golangci-lint run -v ./...
41
+
42
+
# Integration test commands
43
+
.PHONY: integration-test
44
+
integration-test: integration-test-clean
45
+
@echo "🏗️ Building services..."
46
+
@$(INTEGRATION_COMPOSE) build
47
+
48
+
@echo "🚀 Starting services..."
49
+
@$(INTEGRATION_COMPOSE) up -d
50
+
51
+
@echo "⏳ Waiting for services to be ready..."
52
+
@for i in$$(seq 1 10);do\
53
+
echo -n "$$i... ";\
54
+
sleep 1;\
55
+
done;\
56
+
echo""
57
+
58
+
@echo "🏗️ Building test runner..."
59
+
@$(INTEGRATION_COMPOSE) --profile test build test-runner
60
+
61
+
@echo "🧪 Running integration tests..."
62
+
@TEST_NAME="$${TEST_NAME:-}"&&\
63
+
if [ -n"$$TEST_NAME" ];then \
64
+
echo"Running specific test: $$TEST_NAME";\
65
+
$(INTEGRATION_COMPOSE) --profile test run --rm test-runner go test -v -tags=integration ./... -run=$$TEST_NAME || (echo "❌ Tests failed!";$(MAKE) integration-test-clean;exit 1);\
66
+
else\
67
+
echo"Running all tests";\
68
+
$(INTEGRATION_COMPOSE) --profile test run --rm test-runner || (echo "❌ Tests failed!";$(MAKE) integration-test-clean;exit 1);\
Copy file name to clipboardExpand all lines: README.md
+68-1Lines changed: 68 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,12 +21,79 @@ This project uses [golangci-lint](https://golangci-lint.run/) for linting, this
21
21
To run locally use `make lint` which runs linting using docker however if you want to run it locally using a binary release (which can be faster) follow the [installation instructions for your platform](https://golangci-lint.run/usage/install/) and then run `golangci-lint run -v ./...`
22
22
23
23
## Testing
24
-
Run the below command in order to test changes, if you have an M1 / M2 Mac (or ARM based processor) follow the steps below to setup docker to be able to run the tests
24
+
25
+
### Unit Tests
26
+
27
+
Run the below command in order to test changes, if you have an M1 / M2 Mac (or ARM based processor) follow the steps below to setup docker to be able to run the tests
25
28
```
26
29
make docker-test
27
30
```
28
31
32
+
### Integration Tests
33
+
34
+
The project includes comprehensive integration tests that verify the entire system working together with all dependencies.
35
+
36
+
#### What the Integration Tests Do
37
+
38
+
The integration tests:
39
+
- Spin up a complete environment with PostgreSQL, Kafka, Zookeeper, LocalStack (for DynamoDB), and the application
40
+
- Test end-to-end flows including:
41
+
- Token redemption flows through Kafka
42
+
- Token signing flows through Kafka
43
+
- Database persistence and retrieval
44
+
- DynamoDB operations
45
+
- Verify the application correctly processes messages between Kafka topics
46
+
- Ensure proper communication between all services
47
+
48
+
#### Running Integration Tests
49
+
50
+
To run the integration tests, simply use:
51
+
52
+
```bash
53
+
# run all integration tests
54
+
make integration-test
55
+
# or run a specific integration test
56
+
make integration-test TEST_NAME=TestTokenIssuanceViaKafkaAndRedeemViaHTTPFlow
57
+
```
58
+
59
+
This command will:
60
+
1. Clean up any existing test containers
61
+
2. Build all required services
62
+
3. Start the test environment (PostgreSQL, Kafka, Zookeeper, LocalStack)
63
+
4. Wait for all services to be healthy and ready (~30 seconds)
64
+
5. Build and run the test suite
65
+
6. Automatically clean up all containers and volumes after completion
66
+
67
+
#### Manual Cleanup
68
+
69
+
If the tests are interrupted or you need to manually clean up the test environment:
70
+
71
+
```bash
72
+
make integration-test-clean
73
+
```
74
+
75
+
This will remove all test containers, networks, and volumes created by the integration tests.
76
+
77
+
#### Viewing Logs
78
+
79
+
To debug issues or view what's happening during the tests:
80
+
81
+
```bash
82
+
make integration-test-logs
83
+
```
84
+
85
+
This will tail the logs from all services in the integration test environment.
86
+
87
+
#### Test Configuration
88
+
89
+
The integration tests use a separate `docker-compose.integration.yml` file which:
90
+
- Creates isolated test topics in Kafka
91
+
- Uses a dedicated test database
92
+
- Runs LocalStack for DynamoDB emulation
93
+
- Configures all services with test-specific settings
94
+
29
95
### Have an M1 / M2 (ARM) Mac?
96
+
30
97
1.) In Docker Desktop, go to: `Settings -> Docker Engine` <br />
0 commit comments