diff options
author | Silvio Fricke | 2021-03-29 20:12:09 +0200 |
---|---|---|
committer | Silvio Fricke | 2021-03-29 20:12:09 +0200 |
commit | 0418d63b1286faf8d9baaf07c56631ddb46c4a76 (patch) | |
tree | 15e2c59313ff96355e907bcc8dc59ab24f8df795 /Makefile | |
parent | 5f6fef02f41752c3c75de9797c8345e89f0d9fe3 (diff) | |
download | languagetool-0418d63b1286faf8d9baaf07c56631ddb46c4a76.tar.gz |
make: rework test strategy
Signed-off-by: Silvio Fricke <silvio.fricke@softing.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 44 |
1 files changed, 35 insertions, 9 deletions
@@ -5,19 +5,45 @@ prepare: build: docker build -t silvio/docker-languagetool . -test: +test: test-cleanup.1 +test: TESTIPADDRESS=$(subst ",,$(shell docker inspect languagetool | jq '.[0].NetworkSettings.IPAddress')) +test: test-print-ip-address +test: test-start +test: test-run-test-lang +test: test-run-test-en +test: test-run-test-fr +test: test-cleanup.2 + +test-start: docker run -d --name languagetool -p 8010:8010 silvio/docker-languagetool - sleep 5 + sleep 3 + +test-print-ip-address: + @echo "IP address of languagetools docker container: $(TESTIPADDRESS)" + +test-run-test-lang: + curl \ + -X GET \ + --header 'Accept: application/json' \ + 'http://$(TESTIPADDRESS):8010/v2/languages' - echo "get all languages" - curl -X GET --header 'Accept: application/json' 'http://172.17.0.1:8010/v2/languages' +test-run-test-en: + curl \ + -X POST \ + --header 'Content-Type: application/x-www-form-urlencoded' \ + --header 'Accept: application/json' \ + -d 'text=hello%20woorld&language=en-US&motherTongue=de-DE&enabledOnly=false' \ + 'http://$(TESTIPADDRESS):8010/v2/check' - echo "test en-US" - curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'text=hello%20woorld&language=en-US&motherTongue=de-DE&enabledOnly=false' 'http://172.17.0.1:8010/v2/check' +test-run-test-fr: + curl -X POST \ + --header 'Content-Type: application/x-www-form-urlencoded' \ + --header 'Accept: application/json' \ + -d 'text=hello%20woorld&language=fr&motherTongue=de-DE&enabledOnly=false' \ + 'http://$(TESTIPADDRESS):8010/v2/check' - echo "test fr" - curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'text=hello%20woorld&language=fr&motherTongue=de-DE&enabledOnly=false' 'http://172.17.0.1:8010/v2/check' -stop: +.PHONY: test-cleanup +test-cleanup.%: docker stop languagetool docker rm languagetool |