Skip to content

Commit 00356d8

Browse files
committed
test recCeiver to ChannelFinder end to end
Adds a Dockerfile for recCeiver Adds a Dockerfile and compose for the client demo for testing purposes Adds a docker-compose file for the recCeiver with - one running ChannelFinder - two running recCeivers - two iocdemos per recCeiver Adds an end to end test for the recCeiver Works by running the docker-compose file and then checking that the ChannelFinder receives the correct number of records Adds the new end to end test to the github actions
1 parent fdcd310 commit 00356d8

File tree

24 files changed

+832
-29
lines changed

24 files changed

+832
-29
lines changed

.github/workflows/server.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ name: recceiver
44
on:
55
push:
66
branches: [ "master" ]
7+
paths:
8+
- server/**
79
pull_request:
810
branches: [ "master" ]
11+
paths:
12+
- server/**
913

1014
jobs:
1115
build-server:
@@ -26,3 +30,30 @@ jobs:
2630
run: |
2731
python -m pip install --upgrade pip
2832
pip install .
33+
test:
34+
runs-on: ubuntu-latest
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] # testcontainers is not supported on <3.9
39+
needs: build-server
40+
defaults:
41+
run:
42+
working-directory: server
43+
steps:
44+
- uses: actions/checkout@v4
45+
- name: Set up Python ${{ matrix.python-version }}
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: ${{ matrix.python-version }}
49+
- name: Install dependencies
50+
run: |
51+
python -m pip install --upgrade pip
52+
python -m pip install '.[test]'
53+
python -m pip install .
54+
- name: Clear existing docker image cache
55+
shell: bash
56+
run: docker image prune -af
57+
- name: Test with pytest
58+
run: |
59+
pytest

.gitignore

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
O.*
2-
bin
3-
lib
4-
dbd
5-
envPaths
6-
dropin.cache
1+
application.log
72

8-
*.pyc
9-
*.pyo
10-
*.log
11-
*.pid
12-
*.db
13-
client/configure/*.local
3+
# python
4+
.venv
145

15-
*~
16-
.*.swp
6+
## caches
7+
.*_cache
8+
9+
# ides
10+
.vscode
11+
.idea

client/.dockerignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
O.*
2+
bin
3+
lib
4+
dbd
5+
envPaths
6+
dropin.cache
7+
8+
*.pyc
9+
*.pyo
10+
*.log
11+
*.pid
12+
*.db
13+
configure/*.local
14+
15+
*~
16+
.*.swp

client/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
O.*
2+
bin
3+
lib
4+
envPaths
5+
dropin.cache
6+
7+
*.pyc
8+
*.pyo
9+
*.log
10+
*.pid
11+
configure/*.local
12+
13+
*~
14+
.*.swp
15+
16+
dbd
17+
db
18+
19+
20+
.iocsh_history

client/Dockerfile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Download Epics
2+
FROM --platform=$BUILDPLATFORM debian:bookworm-slim AS epics-download-extract
3+
SHELL ["/bin/bash", "-c"]
4+
RUN apt-get update && apt-get install -yq wget git
5+
WORKDIR /var/cache
6+
ARG EPICSVERSION=7.0.8.1
7+
RUN wget -q --show-progress https://epics.anl.gov/download/base/base-$EPICSVERSION.tar.gz \
8+
&& mkdir /epics/ \
9+
&& tar -xf base-$EPICSVERSION.tar.gz -C /epics \
10+
&& rm base-$EPICSVERSION.tar.gz
11+
12+
FROM --platform=$BUILDPLATFORM debian:bookworm-slim AS base
13+
14+
FROM base AS base-amd64
15+
ENV EPICS_HOST_ARCH=linux-x86_64
16+
17+
FROM base AS base-386
18+
ENV EPICS_HOST_ARCH=linux-x86
19+
20+
FROM base AS base-arm64
21+
ENV EPICS_HOST_ARCH=linux-arm
22+
23+
FROM base AS base-arm
24+
ENV EPICS_HOST_ARCH=linux-arm
25+
26+
# Now finally choose the right base image:
27+
FROM base-$TARGETARCH AS build-epics
28+
SHELL ["/bin/bash", "-c"]
29+
ENV DEBIAN_FRONTEND=noninteractive
30+
RUN apt-get update \
31+
&& apt-get install --no-install-recommends -yq \
32+
build-essential \
33+
ca-certificates \
34+
curl \
35+
libreadline-dev \
36+
telnet \
37+
&& apt-get clean && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/apt
38+
39+
WORKDIR /epics
40+
COPY --from=epics-download-extract /epics /epics
41+
ARG EPICSVERSION=7.0.8.1
42+
RUN mv base-$EPICSVERSION base
43+
RUN cd base && make -j$(nproc)
44+
45+
FROM build-epics AS recsync-base
46+
47+
WORKDIR /recsync
48+
COPY . /recsync/
49+
RUN mv docker/RELEASE.local configure/RELEASE.local
50+
ENV EPICS_ROOT=/epics
51+
ENV EPICS_BASE=${EPICS_ROOT}/base
52+
RUN make
53+
WORKDIR /recsync/iocBoot/iocdemo
54+
55+
FROM recsync-base AS ioc-runner
56+
57+
CMD /recsync/bin/${EPICS_HOST_ARCH}/demo st.cmd

client/demoApp/Db/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ include $(TOP)/configure/CONFIG
1111
# Create and install (or just install) into <top>/db
1212
# databases, templates, substitutions like this
1313
DB += somerecords.db
14-
14+
DB += archive.db
1515
#----------------------------------------------------
1616
# If <anyname>.db template is not named <anyname>*.template add
1717
# <anyname>_template = <templatename>

client/demoApp/Db/archive.db

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
record(ai, "$(P)ai:archive") {
3+
info("test", "testing")
4+
info("archive", "MONITOR@1")
5+
}
6+
7+
record(longout, "$(P)lo:archive") {
8+
info("test", "testing")
9+
info("hello", "world")
10+
info("archive", "default")
11+
}

client/demoApp/Db/somerecords.db

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

2-
record(longin, "$(P)li") {
2+
record(longin, "$(P):li") {
33
alias("$(P)lix1")
44
alias("$(P)lix2")
55
info("test", "testing")
66
}
77

8-
record(longout, "$(P)lo") {
8+
record(longout, "$(P):lo") {
99
info("test", "testing")
1010
info("hello", "world")
1111
}

client/demoApp/src/demoMain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ int main(int argc,char *argv[])
1919
}
2020
iocsh(NULL);
2121
epicsExit(0);
22-
return(0);
22+
return 0;
2323
}

client/docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
services:
3+
ioc1:
4+
build: ../client
5+
environment:
6+
- IOCSH_NAME=IOC1-2
7+
tty: true
8+
networks:
9+
- net-recc-1
10+
11+
networks:
12+
net-recc-1:
13+
driver: bridge

0 commit comments

Comments
 (0)