Skip to content

Commit bf60780

Browse files
marc0oloclaude
andcommitted
chore(rust/unit_testable_rust_canister): test.sh over Makefile, bump CI image to 1.0.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2d1cba7 commit bf60780

4 files changed

Lines changed: 53 additions & 53 deletions

File tree

.github/workflows/unit_testable_rust_canister.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ concurrency:
1515
jobs:
1616
rust-unit_testable_rust_canister:
1717
runs-on: ubuntu-24.04
18-
container: ghcr.io/dfinity/icp-dev-env-rust:1.0.0
18+
container: ghcr.io/dfinity/icp-dev-env-rust:1.0.1
1919
env:
2020
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2121
steps:
@@ -28,4 +28,4 @@ jobs:
2828
run: |
2929
icp network start -d
3030
icp deploy
31-
make test
31+
bash test.sh

rust/unit_testable_rust_canister/Makefile

Lines changed: 0 additions & 50 deletions
This file was deleted.

rust/unit_testable_rust_canister/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ cargo test
175175
```bash
176176
icp network start -d
177177
icp deploy
178-
make test
178+
bash test.sh
179179
icp network stop
180180
```
181181

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
echo "=== Test 1: get_count returns 0 initially ==="
5+
result=$(icp canister call --query backend get_count '(record {})') && \
6+
echo "$result" && \
7+
echo "$result" | grep -q 'count = opt (0' && \
8+
echo "PASS" || (echo "FAIL" && exit 1)
9+
10+
echo "=== Test 2: increment_count returns new_count = 1 ==="
11+
result=$(icp canister call backend increment_count '(record {})') && \
12+
echo "$result" && \
13+
echo "$result" | grep -q 'new_count = opt (1' && \
14+
echo "PASS" || (echo "FAIL" && exit 1)
15+
16+
echo "=== Test 3: get_count returns 1 after increment ==="
17+
result=$(icp canister call --query backend get_count '(record {})') && \
18+
echo "$result" && \
19+
echo "$result" | grep -q 'count = opt (1' && \
20+
echo "PASS" || (echo "FAIL" && exit 1)
21+
22+
echo "=== Test 4: increment_count again returns new_count = 2 ==="
23+
result=$(icp canister call backend increment_count '(record {})') && \
24+
echo "$result" && \
25+
echo "$result" | grep -q 'new_count = opt (2' && \
26+
echo "PASS" || (echo "FAIL" && exit 1)
27+
28+
echo "=== Test 5: decrement_count returns new_count = 1 ==="
29+
result=$(icp canister call backend decrement_count '(record {})') && \
30+
echo "$result" && \
31+
echo "$result" | grep -q 'new_count = opt (1' && \
32+
echo "PASS" || (echo "FAIL" && exit 1)
33+
34+
echo "=== Test 6: get_count returns 1 after decrement ==="
35+
result=$(icp canister call --query backend get_count '(record {})') && \
36+
echo "$result" && \
37+
echo "$result" | grep -q 'count = opt (1' && \
38+
echo "PASS" || (echo "FAIL" && exit 1)
39+
40+
echo "=== Test 7: get_proposal_info with missing proposal_id returns error ==="
41+
result=$(icp canister call backend get_proposal_info '(record { proposal_id = null })') && \
42+
echo "$result" && \
43+
echo "$result" | grep -q 'Missing proposal_id' && \
44+
echo "PASS" || (echo "FAIL" && exit 1)
45+
46+
echo "=== Test 8: get_proposal_titles returns titles list ==="
47+
result=$(icp canister call backend get_proposal_titles '(record { limit = null })') && \
48+
echo "$result" && \
49+
echo "$result" | grep -q 'titles' && \
50+
echo "PASS" || (echo "FAIL" && exit 1)

0 commit comments

Comments
 (0)