Skip to content

Commit

Permalink
Merge pull request #9 from uselagoon/add_mysql
Browse files Browse the repository at this point in the history
Included mysql in test suite
  • Loading branch information
tobybellwood authored Jun 5, 2024
2 parents 862df79 + 74880a3 commit ace80f3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
8 changes: 8 additions & 0 deletions TESTING_dockercompose.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb?servic
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb?service=mariadb-10-11" | grep "SERVICE_HOST=10.11"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mariadb?service=mariadb-10-11" | grep "LAGOON_TEST_VAR=internal-services-test"

# mysql-8-0 should be able to read/write data
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mysql?service=mysql-8-0" | grep "SERVICE_HOST=8.0"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mysql?service=mysql-8-0" | grep "LAGOON_TEST_VAR=internal-services-test"

# mysql-8-4 should be able to read/write data
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mysql?service=mysql-8-4" | grep "SERVICE_HOST=8.4"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/mysql?service=mysql-8-4" | grep "LAGOON_TEST_VAR=internal-services-test"

# postgres-12 should be able to read/write data
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-12" | grep "SERVICE_HOST=PostgreSQL 12"
docker compose exec -T commons sh -c "curl -kL http://go-web:3000/postgres?service=postgres-12" | grep "LAGOON_TEST_VAR=internal-services-test"
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ services:
ports:
- '5432'

mysql-8-0:
image: testlagoon/mysql-8.0:pr-308
labels:
lagoon.type: mariadb
ports:
- "3306"

mysql-8-4:
image: testlagoon/mysql-8.4:pr-308 # Placeholder
labels:
lagoon.type: mariadb
ports:
- "3306"

opensearch-2:
image: uselagoon/opensearch-2:latest
environment:
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func main() {
r.HandleFunc("/mongo", mongoHandler)
r.HandleFunc("/opensearch", opensearchHandler)
r.HandleFunc("/storage", persistentStorageHandler)
r.HandleFunc("/mysql", mariadbHandler)
r.HandleFunc("/", handleReq)
http.Handle("/", r)

Expand Down Expand Up @@ -72,7 +73,7 @@ func connectorKeyValues(values []string) string {

func cleanRoute(basePath string) (string, string) {
cleanRoute := strings.ReplaceAll(basePath, "/", "")
localService := strings.ReplaceAll(cleanRoute, "10.", "10-")
localService := strings.ReplaceAll(cleanRoute, ".", "-")
replaceHyphen := strings.ReplaceAll(localService, "-", "_")
lagoonService := strings.ToUpper(replaceHyphen)
return localService, lagoonService
Expand Down

0 comments on commit ace80f3

Please sign in to comment.