[master] abfa8c98f varnishtest: ensure varnishd has a workdir always
Nils Goroll
nils.goroll at uplex.de
Thu Feb 20 12:40:06 UTC 2025
commit abfa8c98fe42b9cbfaba3700f8fe1801ac0dc920
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Wed Feb 19 16:58:55 2025 +0100
varnishtest: ensure varnishd has a workdir always
We have at least one in out tests where we start varnishd without a -n argument
(e.g. m00003.vtc), but the system wide default might actually not even work.
Rather than adding -n specifically, we add a global VARNISH_DEFAULT_N
environment variable and simplify the other cases where we now no longer need an
-n argument.
diff --git a/bin/varnishtest/tests/b00045.vtc b/bin/varnishtest/tests/b00045.vtc
index ec8c5cb51..183d30e2f 100644
--- a/bin/varnishtest/tests/b00045.vtc
+++ b/bin/varnishtest/tests/b00045.vtc
@@ -15,11 +15,11 @@ client c1 {
delay .2
shell -err -expect {Error: Could not open pid-file} {
- varnishd -P /dev/tty -b None -a :0 -n ${tmpdir}
+ varnishd -P /dev/tty -b None -a :0
}
shell -err -expect {Error: Varnishd is already running} {
- varnishd -P ${v1_name}/varnishd.pid -b None -a :0 -n ${tmpdir}
+ varnishd -P ${v1_name}/varnishd.pid -b None -a :0
}
shell -err -expect {Error: Varnishd is already running} {
diff --git a/bin/varnishtest/tests/c00003.vtc b/bin/varnishtest/tests/c00003.vtc
index 1ad256922..6592e2044 100644
--- a/bin/varnishtest/tests/c00003.vtc
+++ b/bin/varnishtest/tests/c00003.vtc
@@ -126,10 +126,10 @@ shell -err -expect "Invalid sub-arg =foo" {
# All bad listen addresses
shell -err -expect "Error: Could not get socket" {
- varnishd -F -a "${bad_ip}:0" -b '***' -n ${tmpdir}
+ varnishd -F -a "${bad_ip}:0" -b '***'
}
# old style address list
shell -err -expect "Unknown protocol" {
- varnishd -F -a "${listen_addr},${bad_ip}:0" -b '***' -n ${tmpdir}
+ varnishd -F -a "${listen_addr},${bad_ip}:0" -b '***'
}
diff --git a/bin/varnishtest/tests/p00000.vtc b/bin/varnishtest/tests/p00000.vtc
index d31177f73..96aadbdfa 100644
--- a/bin/varnishtest/tests/p00000.vtc
+++ b/bin/varnishtest/tests/p00000.vtc
@@ -3,7 +3,7 @@ varnishtest "Test Basic persistence"
feature persistent_storage
process p1 -dump {
- varnishd -spersistent -b ${localhost} -n ${tmpdir} -a :0 -d 2>&1
+ varnishd -spersistent -b ${localhost} -a :0 -d 2>&1
} -start -expect-exit 1
process p1 -expect-text 0 0 {to launch}
diff --git a/bin/varnishtest/tests/r02321.vtc b/bin/varnishtest/tests/r02321.vtc
index 1596456ff..efde8643c 100644
--- a/bin/varnishtest/tests/r02321.vtc
+++ b/bin/varnishtest/tests/r02321.vtc
@@ -2,18 +2,15 @@ varnishtest "Storage name collisions"
# intentional collision
shell -err -expect "Error: (-s main=default,100m) 'main' is already defined" {
- exec varnishd -a :0 -f '' -n ${tmpdir} \
- -s main=default,10m -s main=default,100m
+ exec varnishd -a :0 -f '' -s main=default,10m -s main=default,100m
}
# pseudo-accidental collision
shell -err -expect "Error: (-s s0=default,100m) 's0' is already defined" {
- exec varnishd -a :0 -f '' -n ${tmpdir} \
- -s default,10m -s s0=default,100m
+ exec varnishd -a :0 -f '' -s default,10m -s s0=default,100m
}
# Transient collision
shell -err -expect "Error: (-s Transient=default,100m) 'Transient' is already defined" {
- exec varnishd -a :0 -f '' -n ${tmpdir} \
- -s Transient=default,10m -s Transient=default,100m
+ exec varnishd -a :0 -f '' -s Transient=default,10m -s Transient=default,100m
}
diff --git a/bin/varnishtest/tests/r02325.vtc b/bin/varnishtest/tests/r02325.vtc
index fab645a53..ef00ed4e5 100644
--- a/bin/varnishtest/tests/r02325.vtc
+++ b/bin/varnishtest/tests/r02325.vtc
@@ -1,8 +1,8 @@
varnishtest "validate storage identifiers"
shell -err -expect {Error: invalid -s name "///"=[...]} {
- varnishd -a :0 -n ${tmpdir} -F -f '' -s ///=default
+ varnishd -a :0 -F -f '' -s ///=default
}
shell -err -expect {Error: Empty named -s argument "foo="} {
- varnishd -a :0 -n ${tmpdir} -F -f '' -s foo=
+ varnishd -a :0 -F -f '' -s foo=
}
diff --git a/bin/varnishtest/tests/s00003.vtc b/bin/varnishtest/tests/s00003.vtc
index b15de012c..5c79e70db 100644
--- a/bin/varnishtest/tests/s00003.vtc
+++ b/bin/varnishtest/tests/s00003.vtc
@@ -46,14 +46,14 @@ varnish v1 -vsl_catchup
varnish v1 -cliok "ban obj.http.date ~ ."
process p1 {
- varnishd -sTransient=file,${tmpdir}/foo,xxx -b${localhost} -a:0 -n ${tmpdir} 2>&1
+ varnishd -sTransient=file,${tmpdir}/foo,xxx -b${localhost} -a:0 2>&1
} -expect-exit 0x2 -dump -start -expect-text 0 0 "Invalid number" -wait -screen_dump
process p1 {
- varnishd -sTransient=file,${tmpdir}/foo,10M,xxx -b${localhost} -a:0 -n ${tmpdir} 2>&1
+ varnishd -sTransient=file,${tmpdir}/foo,10M,xxx -b${localhost} -a:0 2>&1
} -expect-exit 0x2 -dump -start -expect-text 0 0 "granularity" -wait -screen_dump
process p1 {
- varnishd -sTransient=file,${tmpdir}/foo,10m,,foo -b${localhost} -a:0 -n ${tmpdir} 2>&1
+ varnishd -sTransient=file,${tmpdir}/foo,10m,,foo -b${localhost} -a:0 2>&1
} -expect-exit 0x2 -dump -start -expect-text 0 0 "invalid advice" -wait
diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index b3e58f6b8..9880c7c5e 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -399,6 +399,7 @@ start_test(void)
int p[2], retval;
struct vtc_job *jp;
char tmpdir[PATH_MAX];
+ char default_n[PATH_MAX];
ALLOC_OBJ(jp, JOB_MAGIC);
AN(jp);
@@ -409,6 +410,10 @@ start_test(void)
(unsigned)random());
AZ(mkdir(tmpdir, 0755));
+ bprintf(default_n, "%s/default_n", tmpdir);
+
+ AZ(setenv("VARNISH_DEFAULT_N", default_n, 1));
+
tp = VTAILQ_FIRST(&tst_head);
CHECK_OBJ_NOTNULL(tp, TST_MAGIC);
AN(tp->ntodo);
More information about the varnish-commit
mailing list