Skip to content

Commit f26e672

Browse files
committed
Move html to separate template file
1 parent 74951cb commit f26e672

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

data/containers/helm/kiosk/audio.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Sample audio file</title>
5+
</head>
6+
<body>
7+
<audio loop controls> <!-- autoplay is blocked in modern browsers -->
8+
<source src="%DATA_URL%/bar.wav" type="audio/wav">
9+
Your browser does not support the audio tag.
10+
</audio>
11+
</body>
12+
</html>

tests/containers/charts/kiosk_firefox.pm

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,18 @@ use utils;
1616
use containers::helm;
1717
use containers::k8s qw(install_helm);
1818

19-
20-
my $base_url = autoinst_url;
21-
my $audio_html = <<_EOF_;
22-
<!DOCTYPE html>
23-
<html>
24-
<head>
25-
<title>Sample audio file</title>
26-
</head>
27-
<body>
28-
<audio loop controls> <!-- autoplay is blocked in modern browsers -->
29-
<source src="$base_url/data/bar.wav" type="audio/wav">
30-
Your browser does not support the audio tag.
31-
</audio>
32-
</body>
33-
</html>
34-
_EOF_
35-
3619
sub run {
3720
my ($self) = @_;
3821

3922
select_serial_terminal;
4023
my $helm_chart = get_required_var("HELM_CHART");
41-
my $helm_values = autoinst_url("/data/containers/helm/kiosk/values.yaml");
24+
my $helm_values = data_url("/containers/helm/kiosk/values.yaml");
4225

4326
# Run an nginx container with a test page and wait for it
44-
assert_script_run("kubectl create configmap audio-html-config --from-literal=audio.html='$audio_html'");
45-
assert_script_run("kubectl apply -f " . autoinst_url("/data/containers/helm/kiosk/nginx.yaml"));
27+
assert_script_run("curl -O " . data_url("/containers/helm/kiosk/audio.html"));
28+
file_content_replace("audio.html", '%DATA_URL%' => data_url);
29+
assert_script_run("kubectl create configmap audio-html-config --from-file=audio.html");
30+
assert_script_run("kubectl apply -f " . data_url("/containers/helm/kiosk/nginx.yaml"));
4631
assert_script_run("kubectl wait --for=condition=Ready pod/nginx-test --timeout=60s");
4732

4833
# login to graphical tty before starting
@@ -64,7 +49,7 @@ sub run {
6449
validate_script_output("kubectl exec $pod_name -c pulseaudio -- sh -c 'pactl list sink-inputs'", qr/application.name = "Firefox"/m && qr/application.process.host = "$pod_name"/m, fail_message => 'firefox did not allocate an audio sink');
6550

6651
assert_script_run("helm uninstall kiosk");
67-
script_run("kubectl delete -f " . autoinst_url("/data/containers/helm/kiosk/nginx.yaml"));
52+
script_run("kubectl delete -f " . data_url("/containers/helm/kiosk/nginx.yaml"));
6853
script_run("kubectl create configmap audio-html-config");
6954
}
7055

0 commit comments

Comments
 (0)