Skip to content

Commit 8cb1d4b

Browse files
committed
tests: test env variable config
Signed-off-by: Liam Brady <[email protected]>
1 parent 8ab39ca commit 8cb1d4b

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
topology:
3+
nodes:
4+
- name: r1
5+
cmd: |
6+
echo $foo0
7+
env:
8+
- name: foo0
9+
value: bar
10+
- name: foo1
11+
value: 'bar ''" baz'
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# -*- coding: utf-8 eval: (blacken-mode 1) -*-
2+
# SPDX-License-Identifier: GPL-2.0-or-later
3+
#
4+
# April 18 2025, Liam Brady <[email protected]>
5+
#
6+
# Copyright (c) 2022, LabN Consulting, L.L.C.
7+
#
8+
"""Test for config of env variables.
9+
10+
This test is for ensuring that configured environment variables properly appear
11+
within run commands.
12+
"""
13+
import munet
14+
from munet.mutest.userapi import match_step
15+
from munet.mutest.userapi import section
16+
17+
# Configured environment variables also should be set within
18+
# new munet windows, however, this is not tested here.
19+
20+
section("Test config for env variables")
21+
22+
match_step(
23+
"r1",
24+
"cat cmd.out",
25+
"bar",
26+
"Check for env variable in cmd.out",
27+
exact_match=True,
28+
)
29+
match_step(
30+
"r1",
31+
"echo $foo0",
32+
"bar",
33+
"Check for env variable in Linux namespace",
34+
exact_match=True,
35+
)
36+
match_step(
37+
"r1",
38+
"echo $foo1",
39+
"bar '\" baz",
40+
"Check env variable for proper quoting",
41+
exact_match=True,
42+
)

0 commit comments

Comments
 (0)