Skip to content

Commit 4ca3464

Browse files
authored
Merge pull request #621 from pinheadmz/testframework-cp
Make test_framework available for users when creating scenarios
2 parents 9b7a5c9 + 5ee0c8b commit 4ca3464

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+197
-222
lines changed

.github/workflows/deploy.yml

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

.github/workflows/test.yml

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -30,34 +30,8 @@ jobs:
3030
enable-cache: true
3131
- run: uvx ruff format . --check
3232

33-
build-image:
34-
needs: [ruff, ruff-format]
35-
runs-on: ubuntu-latest
36-
steps:
37-
- name: Checkout
38-
uses: actions/checkout@v4
39-
40-
- name: Set up Docker Buildx
41-
uses: docker/setup-buildx-action@v3
42-
43-
- name: Build and export
44-
uses: docker/build-push-action@v5
45-
with:
46-
file: resources/images/commander/Dockerfile
47-
context: .
48-
tags: bitcoindevproject/warnet-commander:latest
49-
cache-from: type=gha
50-
cache-to: type=gha,mode=max
51-
outputs: type=docker,dest=/tmp/commander.tar
52-
53-
- name: Upload artifact
54-
uses: actions/upload-artifact@v4
55-
with:
56-
name: commander
57-
path: /tmp/commander.tar
58-
5933
test:
60-
needs: [build-image]
34+
needs: [ruff, ruff-format]
6135
runs-on: ubuntu-latest
6236
strategy:
6337
matrix:
@@ -80,11 +54,6 @@ jobs:
8054
memory: 4000m
8155
- name: Start minikube's loadbalancer tunnel
8256
run: minikube tunnel &> /dev/null &
83-
- name: Download commander artifact
84-
uses: actions/download-artifact@v4
85-
with:
86-
name: commander
87-
path: /tmp
8857
- name: Install the latest version of uv
8958
uses: astral-sh/setup-uv@v2
9059
with:
@@ -94,12 +63,6 @@ jobs:
9463
run: uv python install $PYTHON_VERSION
9564
- name: Install project
9665
run: uv sync --all-extras --dev
97-
- name: Install commander image
98-
run: |
99-
echo loading commander image into minikube docker
100-
eval $(minikube -p minikube docker-env)
101-
docker load --input /tmp/commander.tar
102-
docker image ls -a
10366
- name: Run tests
10467
run: |
10568
source .venv/bin/activate

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ build-backend = "setuptools.build_meta"
5151
include-package-data = true
5252

5353
[tool.setuptools.packages.find]
54-
where = ["src", "."]
54+
where = ["src", ".", "resources/scenarios"]
5555
include = ["warnet*", "test_framework*", "resources*"]
5656

5757
[tool.setuptools.package-data]

resources/charts/commander/templates/configmap.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
apiVersion: v1
22
kind: ConfigMap
3-
metadata:
4-
name: {{ include "commander.fullname" . }}-scenario
5-
labels:
6-
{{- include "commander.labels" . | nindent 4 }}
7-
binaryData:
8-
scenario.py: {{ .Values.scenario }}
9-
---
10-
apiVersion: v1
11-
kind: ConfigMap
123
metadata:
134
name: {{ include "commander.fullname" . }}-warnet
145
labels:

resources/charts/commander/templates/pod.yaml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,30 @@ metadata:
88
mission: commander
99
spec:
1010
restartPolicy: {{ .Values.restartPolicy }}
11+
initContainers:
12+
- name: init
13+
image: busybox
14+
command: ["/bin/sh", "-c"]
15+
args:
16+
- |
17+
while [ ! -f /shared/archive.pyz ]; do
18+
echo "Waiting for /shared/archive.pyz to exist..."
19+
sleep 2
20+
done
21+
volumeMounts:
22+
- name: shared-volume
23+
mountPath: /shared
1124
containers:
1225
- name: {{ .Chart.Name }}
13-
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
14-
imagePullPolicy: {{ .Values.image.pullPolicy }}
26+
image: python:3.12-slim
27+
imagePullPolicy: IfNotPresent
1528
command: ["/bin/sh", "-c"]
1629
args:
1730
- |
18-
python3 /scenario.py {{ .Values.args }}
31+
python3 /shared/archive.pyz {{ .Values.args }}
1932
volumeMounts:
20-
- name: scenario
21-
mountPath: /scenario.py
22-
subPath: scenario.py
23-
- name: warnet
24-
mountPath: /warnet.json
25-
subPath: warnet.json
33+
- name: shared-volume
34+
mountPath: /shared
2635
volumes:
27-
- name: scenario
28-
configMap:
29-
name: {{ include "commander.fullname" . }}-scenario
30-
- name: warnet
31-
configMap:
32-
name: {{ include "commander.fullname" . }}-warnet
36+
- name: shared-volume
37+
emptyDir: {}

resources/charts/commander/values.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ namespace: warnet
55

66
restartPolicy: Never
77

8-
image:
9-
repository: bitcoindevproject/warnet-commander
10-
pullPolicy: IfNotPresent
11-
# Overrides the image tag whose default is the chart appVersion.
12-
tag: "latest"
13-
148
imagePullSecrets: []
159
nameOverride: ""
1610
fullnameOverride: ""
@@ -71,8 +65,6 @@ volumeMounts: []
7165

7266
port:
7367

74-
scenario: ""
75-
7668
warnet: ""
7769

7870
args: ""

resources/images/commander/Dockerfile

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

resources/networks/6_node_bitcoin/network.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,5 @@ nodes:
2828
connect:
2929
- tank-0006
3030
- name: tank-0006
31-
fork_observer:
32-
enabled: true
3331
caddy:
3432
enabled: true

resources/scenarios/commander.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import signal
99
import sys
1010
import tempfile
11-
from pathlib import Path
1211
from typing import Dict
1312

1413
from test_framework.authproxy import AuthServiceProxy
@@ -21,7 +20,7 @@
2120
from test_framework.test_node import TestNode
2221
from test_framework.util import PortSeed, get_rpc_proxy
2322

24-
WARNET_FILE = Path(os.path.dirname(__file__)) / "warnet.json"
23+
WARNET_FILE = "/shared/warnet.json"
2524

2625
try:
2726
with open(WARNET_FILE) as file:

0 commit comments

Comments
 (0)