geniusjoe opened a new issue, #1282:
URL: https://github.com/apache/pulsar-client-go/issues/1282
**Is your feature request related to a problem? Please describe.**
When I ran `make test`, every test case worked fine except one error from
`test_extensible_load_manager` :
```
✔ Network blue-green_green-pulsar Created
0.0s
✔ Container green-zookeeper Healthy
15.9s
✔ Container green-pulsar-init Exited
15.2s
✔ Container green-bookie Started
15.3s
✔ Container green-broker-2 Started
16.1s
✔ Container green-broker-1 Started
16.1s
✔ Container green-proxy Started
16.1s
until curl http://localhost:8081/metrics > /dev/null 2>&1 ; do sleep 1; done
# run blue-green migration test (run this test from this env to access both
clusters)
go test -race -coverprofile=/tmp/coverage-blue_green_topic_migration
-timeout=5m -tags extensible_load_manager -v -run
TestBlueGreenMigrationTestSuite ./pulsar
go: github.com/99designs/[email protected] requires
github.com/dvsekhvalnov/[email protected]: missing go.sum entry; to add
it:
go mod download github.com/dvsekhvalnov/jose2go
make: *** [test_extensible_load_manager] Error 1
```
This is because `TestBlueGreenMigrationTestSuite` uses host go environment
to run test cases, and my environment doesn't have related dependencies:
```
# Makefile
test_extensible_load_manager: container
...
# run blue-green migration test (run this test from this env to access
both clusters)
go test -race -coverprofile=/tmp/coverage-blue_green_topic_migration
-timeout=5m -tags extensible_load_manager -v -run
TestBlueGreenMigrationTestSuite ./pulsar
go tool cover -html=/tmp/coverage-blue_green_topic_migration -o
coverage-blue_green_topic_migration.html
...
```
I think maybe it is better to use `pulsar-client-go-test` test docker like
other test cases to avoid dependencies conflict.
**Describe the solution you'd like**
1. Since `TestBlueGreenMigrationTestSuite` use
`integration-tests/extensible-load-manager/docker-compose.yml` as a blue
cluster and use `integration-tests/blue-green/docker-compose.yml` as a green
cluster, two clusters are in different network environments. So we may need to
make them use a same network:
```
#integration-tests/extensible-load-manager/docker-compose.yml
version: '3'
networks:
pulsar:
driver: bridge
#integration-tests/blue-green/docker-compose.yml
version: '3'
networks:
extensible-load-manager_pulsar:
external: true
```
2. There are same service names in two `docker-compose.yml` files, we may
need to use new unique service names in
`integration-tests/blue-green/docker-compose.yml` green cluster service:
```
# Start ZooKeeper
green-zookeeper:
container_name: green-zookeeper
...
networks:
- extensible-load-manager_pulsar
environment:
- metadataStoreUrl=zk:green-zookeeper:2181
- PULSAR_MEM=-Xms128m -Xmx128m -XX:MaxDirectMemorySize=56m
```
3. Replace `go test -race` with `docker run pulsar-client-go-test:latest
bash -c` in Makefile
```
#go test -race -coverprofile=/tmp/coverage-blue_green_topic_migration
-timeout=5m -tags extensible_load_manager -v -run
TestBlueGreenMigrationTestSuite ./pulsar
#go tool cover -html=/tmp/coverage-blue_green_topic_migration -o
coverage-blue_green_topic_migration.html
docker run --rm --network="extensible-load-manager_pulsar" -i
${IMAGE_NAME} bash -c "cd /pulsar/pulsar-client-go &&
./scripts/run-ci-blue-green-cluster.sh"
```
4. Since we already use test docker in step3, we cannot use service
forwarding port anymore. Instead we may need to change service forwarding port
to service name in `pulsar/blue_green_migration_test.go`:
```
# Before
for _, scenario := range []topicUnloadTestCase{
{
testCaseName: "proxyConnection",
blueAdminURL: "http://localhost:8080",
blueClientUrl: "pulsar://localhost:6650",
greenAdminURL: "http://localhost:8081",
migrationBody: `
{
"serviceUrl":
"http://localhost:8081",
"serviceUrlTls":"https://localhost:8085",
"brokerServiceUrl":
"pulsar://localhost:6651",
"brokerServiceUrlTls":
"pulsar+ssl://localhost:6655"
}
`,
},
# After
for _, scenario := range []topicUnloadTestCase{
{
testCaseName: "proxyConnection",
blueAdminURL: "http://proxy:8080",
blueClientUrl: "pulsar://proxy:6650",
greenAdminURL: "http://green-proxy:8080",
migrationBody: `
{
"serviceUrl":
"http://green-proxy:8080",
"brokerServiceUrl":
"pulsar://green-proxy:6650",
}
`,
},
}
```
**Describe alternatives you've considered**
I think we can use `docker run --rm --network=host` in Makefile so that
docker `pulsar-client-go-test` can have all docker network access priorities.
But `network=host` option seems only work in Linux environment and can break
platform compatibility.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]