Skip to content

Commit

Permalink
feat: add docker test script (#103)
Browse files Browse the repository at this point in the history
* add docker test

* format

* typo

* feedback

* use tagged docker name

* feedbac
  • Loading branch information
xiaozhenliu-gg5 authored Nov 6, 2019
1 parent 2ae6f8a commit 79deccc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ pbjs-genfiles/
*test-out*
docker/package.tgz
*.tgz
.showcase-typescript
23 changes: 23 additions & 0 deletions docker/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

### Test script pulling the docker image and use it against showcase proto.

# Docker image tag: gapic-generator-typescript:latest.
DIR_NAME=.showcase-typescript
# Remove test directory if it already exists
rm -rf $DIR_NAME
# Create new directory showcase-typescript.
mkdir $DIR_NAME
# Use Docker Image for generating showcase client library
docker run --rm \
--mount type=bind,source=`pwd`/typescript/test/protos/google/showcase/v1beta1,destination=/in/typescript/test/protos/google/showcase/v1beta1,readonly \
--mount type=bind,source=`pwd`/$DIR_NAME,destination=/out \
gapic-generator-typescript:latest
# Test generated client library
cd $DIR_NAME
npm install # install dependencies
npm run fix # format the code
npm test # run unit tests

# Test succeed
echo 'docker test succeeded! '
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"scripts": {
"test": "c8 --reporter=lcov mocha build/test/unit",
"docker-test": "sh docker/test.sh",
"codecov": "c8 --reporter=lcov mocha build/test/unit && c8 report",
"lint": "gts check",
"clean": "gts clean",
Expand Down

0 comments on commit 79deccc

Please sign in to comment.