Add experimental e2e browser fixture

commit-id:5e9d35a3
This commit is contained in:
Leo 2021-12-13 01:45:49 +01:00 committed by Leopold Schabel
parent b0ed42681d
commit 4fef42a5a3
6 changed files with 123 additions and 0 deletions

View File

@ -304,6 +304,24 @@ k8s_resource(
trigger_mode = trigger_mode,
)
# e2e
k8s_yaml_with_ns("devnet/e2e.yaml")
docker_build(
ref = "e2e",
context = "e2e",
dockerfile = "e2e/Dockerfile",
network = "host",
)
k8s_resource(
"e2e",
port_forwards = [
port_forward(6080, name = "VNC [:6080]", host = webHost, link_path = "/vnc_auto.html"),
],
trigger_mode = trigger_mode,
)
# bigtable
def build_cloud_function(container_name, go_func_name, path, builder):

47
devnet/e2e.yaml Normal file
View File

@ -0,0 +1,47 @@
---
apiVersion: v1
kind: Service
metadata:
name: e2e
labels:
app: e2e
spec:
clusterIP: None
selector:
app: e2e
ports:
- port: 6080
name: novnc
protocol: TCP
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: e2e
spec:
selector:
matchLabels:
app: e2e
serviceName: e2e
template:
metadata:
labels:
app: e2e
spec:
restartPolicy: Always
terminationGracePeriodSeconds: 0
containers:
- name: e2e-browser
image: e2e
command:
- ./run.sh
readinessProbe:
httpGet:
path: /
port: 6080
periodSeconds: 1
failureThreshold: 300
ports:
- containerPort: 6080
name: novnc
protocol: TCP

28
e2e/Dockerfile Normal file
View File

@ -0,0 +1,28 @@
# syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
FROM registry.fedoraproject.org/fedora:35@sha256:2d697a06d17691e87212cf248f499dd47db2e275dfe642ffca5975353ea89887
RUN dnf -y install sway wayvnc procps chromium novnc hostname patch
RUN dnf -y install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
COPY managed.json /etc/opt/chrome/policies/managed/managed.json
COPY sway.conf /etc/sway/config.d/20-docker.conf
ENV WLR_BACKENDS=headless
ENV WLR_LIBINPUT_NO_DEVICES=1
ENV WAYLAND_DISPLAY=wayland-1
ENV XDG_RUNTIME_DIR=/home/headless/.run
ENV SWAYSOCK=/tmp/sway.sock
RUN useradd -m -s /bin/bash headless
# Python 3.10 compatibility fix for websockify (novnc dependency)
# (Fedora 35 packaging bug that'll be resolved sooner or later)
RUN sed -i 's/fromstring/frombytes/' /usr/lib/python3.10/site-packages/websockify/*.py && \
sed -i 's/tostring/tobytes/' /usr/lib/python3.10/site-packages/websockify/*.py
USER headless
WORKDIR /home/headless
RUN mkdir -p ~/.config ~/.run
COPY --chown=headless:headless run.sh /home/headless/run.sh

20
e2e/managed.json Normal file
View File

@ -0,0 +1,20 @@
{
"MetricsReportingEnabled": false,
"ExtensionSettings": {
// Install uBlock to test nerd compatibility
"cjpalhdlnbpafiamejdnhcphjbkeiagm": {
"installation_mode": "normal_installed",
"update_url": "https://clients2.google.com/service/update2/crx"
},
// Metamask
"nkbihfbeogaeaoehlefnkodbefgpgknn": {
"installation_mode": "normal_installed",
"update_url": "https://clients2.google.com/service/update2/crx"
},
// Phantom
"bfnaelmomeimhlpmgjnjophhpkkoljpa": {
"installation_mode": "normal_installed",
"update_url": "https://clients2.google.com/service/update2/crx"
}
}
}

8
e2e/run.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
sway &
sleep 0.1
wayvnc :: &
novnc_server &
sleep infinity

2
e2e/sway.conf Normal file
View File

@ -0,0 +1,2 @@
output "HEADLESS-1" resolution 1024x768
exec google-chrome --no-sandbox --no-first-run --no-default-browser-check