Skip to content

Commit bd975fd

Browse files
committed
tests: fix failed ostree.sync on c10s/rhcos10.1
Move the continuous writing to service instead of systemd-run. Fixes openshift/os#1751
1 parent d3ea6a7 commit bd975fd

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

mantle/kola/tests/ostree/sync.go

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ func ostreeSyncTest(c cluster.TestCluster) {
147147
version: 1.5.0
148148
storage:
149149
directories:
150-
- path: /var/tmp/data1
150+
- path: /var/mnt/data1
151151
mode: 0777
152-
- path: /var/tmp/data2
152+
- path: /var/mnt/data2
153153
mode: 0777
154-
- path: /var/tmp/data3
154+
- path: /var/mnt/data3
155155
mode: 0777
156-
- path: /var/tmp/data4
156+
- path: /var/mnt/data4
157157
mode: 0777
158158
files:
159159
- path: /etc/systemd/system.conf
@@ -170,10 +170,26 @@ storage:
170170
#!/bin/bash
171171
i=$1
172172
while true; do
173-
sudo dd if=/dev/urandom of=/var/tmp/data$i/test bs=4096 count=2048 conv=notrunc oflag=append &> /dev/null
173+
dd if=/dev/urandom of=/var/mnt/data$i/test bs=4096 count=2048 conv=notrunc oflag=append &> /dev/null
174174
sleep 0.1
175-
sudo rm -f /var/tmp/data$i/test
176-
done`)
175+
rm -f /var/mnt/data$i/test
176+
done
177+
systemd:
178+
units:
179+
180+
enabled: false
181+
contents: |
182+
[Unit]
183+
Description=Run NFS Random Write Test %I
184+
Requires=multi-user.target
185+
Before=umount.target
186+
DefaultDependencies=no
187+
[Service]
188+
ExecStart=/usr/local/bin/nfs-random-write.sh %I
189+
Type=simple
190+
KillMode=mixed
191+
[Install]
192+
WantedBy=multi-user.target`)
177193
opts := platform.MachineOptions{
178194
MinMemory: 2048,
179195
}
@@ -195,7 +211,7 @@ storage:
195211
// entry point /var/nfs with fsid=0 will be root for clients
196212
// refer to https://access.redhat.com/solutions/107793
197213
_ = c.MustSSHf(nfs_client, `for i in $(seq 4); do
198-
sudo mount -t nfs4 %s:/share$i /var/tmp/data$i
214+
sudo mount -t nfs4 %s:/share$i /var/mnt/data$i
199215
done`, nfs_server.MachineAddress)
200216

201217
mounts := c.MustSSH(nfs_client, "sudo df -Th | grep nfs | wc -l")
@@ -214,23 +230,21 @@ storage:
214230

215231
func doSyncTest(c cluster.TestCluster, client platform.Machine, m platform.Machine) {
216232
// Do simple touch to make sure nfs server works
217-
c.RunCmdSync(client, "sudo touch /var/tmp/data3/test")
233+
c.RunCmdSync(client, "sudo touch /var/mnt/data3/test")
218234
// Continue writing while doing test
219235
// gets run using systemd unit
220-
for i := 1; i <= 4; i++ {
221-
cmd := fmt.Sprintf("sudo systemd-run --unit=nfs%d --no-block sh -c '/usr/local/bin/nfs-random-write.sh %d'", i, i)
222-
_, err := c.SSH(client, cmd)
223-
if err != nil {
224-
c.Fatalf("failed to run nfs-random-write: %v", err)
225-
}
236+
cmd := fmt.Sprintf("sudo systemctl start nfs-random-write@{1..4}.service")
237+
_, err := c.SSH(client, cmd)
238+
if err != nil {
239+
c.Fatalf("failed to run nfs-random-write: %v", err)
226240
}
227241

228242
// block NFS traffic on nfs server
229243
c.RunCmdSync(m, "sudo /usr/local/bin/block-nfs.sh")
230244
// Create a stage deploy using kargs while writing
231245
c.RunCmdSync(client, "sudo rpm-ostree kargs --append=test=1")
232246

233-
err := client.Reboot()
247+
err = client.Reboot()
234248
if err != nil {
235249
c.Fatalf("Couldn't reboot machine: %v", err)
236250
}

0 commit comments

Comments
 (0)