Skip to content
This repository was archived by the owner on Feb 3, 2023. It is now read-only.

Commit 051802c

Browse files
refactor app spec test nix commands
1 parent b907519 commit 051802c

File tree

9 files changed

+40
-87
lines changed

9 files changed

+40
-87
lines changed

Diff for: .circleci/config.yml

+3-9
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
command: nix-shell --run 'aws dynamodb list-tables --endpoint-url=http://localhost:8000'
100100
- run:
101101
name: app spec tests
102-
command: nix-shell --run hc-app-spec-test-sim1h
102+
command: nix-shell --run 'hc-test-app-spec app_spec sim1h'
103103
no_output_timeout: 20m
104104

105105
app-spec-tests-sim2h:
@@ -115,7 +115,7 @@ jobs:
115115
no_output_timeout: 20m
116116
- run:
117117
name: app spec tests
118-
command: nix-shell --run hc-app-spec-test-sim2h
118+
command: nix-shell --run 'hc-test-app-spec app_spec sim2h'
119119
no_output_timeout: 20m
120120

121121
cluster-tests:
@@ -302,16 +302,10 @@ workflows:
302302
- fmt
303303
- app-spec-tests-sim1h
304304
- app-spec-tests-sim2h
305-
# - app-spec-tests-memory
306-
# - app-spec-tests-websocket
307-
# @todo reimplement proc tests properly
308-
# i.e. don't copy and paste app spec and expec it to work with stale state
309-
# - app-spec-proc-tests
310305
- cluster-tests
311306
- cli-tests
312307
- wasm-conductor-tests
313-
# @todo this was flakey
314-
# - stress-tests-sim1h
308+
- stress-tests-sim1h
315309
- stress-tests-sim2h
316310

317311
- docker-build-minimal:

Diff for: app_spec/build_and_test.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env bash
2-
set -euo pipefail
2+
set -euxo pipefail
33
mkdir -p dist
44

55
echo "===================================================================================="
66
echo "RUNNING cargo test for zomes"
7-
echo "Using conductor binary: `which holochain`"
8-
echo "Using cli binary: `which hc`"
7+
echo "Using conductor binary: `command -v holochain`"
8+
echo "Using cli binary: `command -v hc`"
99
echo "------------------------------------------------------------------------------------"
1010

1111
cargo test --manifest-path zomes/blog/code/Cargo.toml
@@ -29,4 +29,6 @@ cd test
2929
# more precisely symlinks are not supported without additional work on the host
3030
# e.g. https://superuser.com/questions/1115329/vagrant-shared-folder-and-symbolic-links-under-windows-10
3131
npm install --no-bin-links
32-
npm run test-ci
32+
if [[ -z ${HC_APP_SPEC_BUILD_RUN:-} ]]
33+
then npm run test-ci
34+
fi

Diff for: app_spec/default.nix

-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
{
33
buildInputs = []
44
++ (pkgs.callPackage ./cluster_test { }).buildInputs
5-
++ (pkgs.callPackage ./test { }).buildInputs
65
;
76
}

Diff for: app_spec/test/default.nix

-41
This file was deleted.

Diff for: app_spec_proc_macro/build_and_test.sh

-32
This file was deleted.

Diff for: app_spec_proc_macro/build_and_test.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../app_spec/build_and_test.sh

Diff for: docker/Dockerfile.circle.sim1h

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ FROM holochain/holochain-rust:latest.${DOCKER_BRANCH}
33

44
RUN nix-shell --run hc-cli-install
55
RUN nix-shell --run hc-conductor-install
6+
RUN nix-shell --run 'HC_APP_SPEC_BUILD_RUN=1 hc-test-app-spec app_spec sim1h'

Diff for: docker/Dockerfile.circle.sim2h

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ FROM holochain/holochain-rust:latest.${DOCKER_BRANCH}
44
RUN nix-shell --run hc-sim2h-server-install
55
RUN nix-shell --run hc-cli-install
66
RUN nix-shell --run hc-conductor-install
7+
RUN nix-shell --run 'HC_APP_SPEC_BUILD_RUN=1 hc-test-app-spec app_spec sim2h'

Diff for: test/app-spec/default.nix

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{ pkgs }:
2+
let
3+
4+
# (cd $app-spec-test-path && APP_SPEC_NETWORK_TYPE="$app-spec-test-network" ./build_and_test.sh);
5+
hc-test-app-spec = pkgs.writeShellScriptBin "hc-test-app-spec" ''
6+
set -euxo pipefail
7+
8+
export app_spec_test_path="''${1:-app_spec}"
9+
export app_spec_test_network="''${2:-sim2h}"
10+
11+
hc-cli-install
12+
hc-conductor-install
13+
14+
(cd $app_spec_test_path && APP_SPEC_NETWORK_TYPE="$app_spec_test_network" ./build_and_test.sh)
15+
16+
hc-cli-uninstall
17+
hc-conductor-uninstall
18+
'';
19+
in
20+
{
21+
buildInputs = [
22+
hc-test-app-spec
23+
];
24+
}

Diff for: test/default.nix

+4
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,9 @@ in
1616
++ (pkgs.callPackage ./fmt {
1717
pkgs = pkgs;
1818
}).buildInputs
19+
20+
++ (pkgs.callPackage ./app-spec {
21+
pkgs = pkgs;
22+
}).buildInputs
1923
;
2024
}

0 commit comments

Comments
 (0)