Skip to content

Commit 56aa961

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 56aa961

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

mantle/kola/tests/ostree/sync.go

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,21 @@ 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
160160
overwrite: true
161161
contents:
162162
inline: |
163163
[Manager]
164-
DefaultTimeoutStopSec=10s
164+
DefaultTimeoutStopSec=30s
165165
- path: /usr/local/bin/nfs-random-write.sh
166166
mode: 0755
167167
overwrite: true
@@ -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
174-
sleep 0.1
175-
sudo rm -f /var/tmp/data$i/test
176-
done`)
173+
dd if=/dev/urandom of=/var/mnt/data$i/test bs=4096 count=2048 conv=notrunc oflag=append &> /dev/null
174+
sleep 0.5
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+
Before=umount.target
185+
After=remote-fs.target
186+
[Service]
187+
ExecStart=/usr/local/bin/nfs-random-write.sh %I
188+
#ExecStopPost=/bin/umount -lf /var/mnt/data%I || true
189+
Type=simple
190+
KillMode=control-group
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,20 @@ 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+
_, err := c.SSH(client, "sudo systemctl start --no-block nfs-random-write@{1..4}.service")
237+
if err != nil {
238+
c.Fatalf("failed to run [email protected]: %v", err)
226239
}
227240

228241
// block NFS traffic on nfs server
229242
c.RunCmdSync(m, "sudo /usr/local/bin/block-nfs.sh")
230243
// Create a stage deploy using kargs while writing
231244
c.RunCmdSync(client, "sudo rpm-ostree kargs --append=test=1")
232245

233-
err := client.Reboot()
246+
err = client.Reboot()
234247
if err != nil {
235248
c.Fatalf("Couldn't reboot machine: %v", err)
236249
}

0 commit comments

Comments
 (0)