Skip to content

Commit 132fa3c

Browse files
Merge pull request #74 from Amnesic-Systems/fix-enclave-tests
Fix in-enclave unit tests.
2 parents 5f29743 + 3e7b63b commit 132fa3c

3 files changed

Lines changed: 17 additions & 15 deletions

File tree

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ enclave: $(godeps) $(image_eif) terminate
5555
--enclave-name veil \
5656
--eif-path $(image_eif) \
5757
--cpu-count 2 \
58-
--memory 3850
58+
--memory 4096
5959

60-
$(image_test_tar): $(godeps) $(image_test_dockerfile)
60+
$(image_test_tar): $(godeps) $(image_test_dockerfile) docker/run-unit-tests.sh
6161
@echo "Building $(image_test_tar)..."
6262
@docker run --volume $(PWD):/workspace \
6363
gcr.io/kaniko-project/executor:v1.9.2 \
@@ -84,7 +84,7 @@ enclave-test: $(godeps) $(image_test_eif) terminate
8484
--eif-path $(image_test_eif) \
8585
--attach-console \
8686
--cpu-count 2 \
87-
--memory 3850
87+
--memory 4096
8888

8989
.PHONY: terminate
9090
terminate:

docker/Dockerfile-unit-test

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,8 @@ COPY cmd/ ./cmd/
77
COPY internal/ ./internal/
88
COPY vendor/ ./vendor/
99
COPY Makefile go.mod go.sum ./
10-
RUN cat > ./run-unit-tests.sh <<EOF
11-
#!/usr/bin/env bash
12-
cd /app
13-
# Needed for Go's build cache.
14-
export HOME=/app
15-
# Needed because otherwise we're getting:
16-
# fork/exec /tmp/go-build1885828642/b001/cmd.test: permission denied
17-
mkdir -p /app/tmp
18-
export TMPDIR=/app/tmp
19-
echo "Running Go unit tests..."
20-
$(which go) test -cover ./...
21-
EOF
10+
COPY docker/run-unit-tests.sh ./run-unit-tests.sh
11+
RUN chmod +x ./run-unit-tests.sh
2212

2313
RUN go mod download
2414

docker/run-unit-tests.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -euxo pipefail
3+
4+
cd /app
5+
# Needed for Go's build cache.
6+
export HOME=/app
7+
# Needed because otherwise we're getting:
8+
# fork/exec /tmp/go-build1885828642/b001/cmd.test: permission denied
9+
mkdir -p /app/tmp
10+
export TMPDIR=/app/tmp
11+
echo "Running Go unit tests..."
12+
$(which go) test -cover ./...

0 commit comments

Comments
 (0)