Skip to content

Commit 44ceaef

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 44ceaef

File tree

1 file changed

+31
-23
lines changed

1 file changed

+31
-23
lines changed

mantle/kola/tests/ostree/sync.go

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,15 @@ 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:
159-
- path: /etc/systemd/system.conf
160-
overwrite: true
161-
contents:
162-
inline: |
163-
[Manager]
164-
DefaultTimeoutStopSec=10s
165159
- path: /usr/local/bin/nfs-random-write.sh
166160
mode: 0755
167161
overwrite: true
@@ -170,10 +164,27 @@ storage:
170164
#!/bin/bash
171165
i=$1
172166
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`)
167+
dd if=/dev/urandom of=/var/mnt/data$i/test bs=4096 count=2048 conv=notrunc oflag=append &> /dev/null
168+
sleep 0.5
169+
rm -f /var/mnt/data$i/test
170+
done
171+
systemd:
172+
units:
173+
174+
enabled: false
175+
contents: |
176+
[Unit]
177+
Description=Run NFS Random Write Test %I
178+
Before=umount.target
179+
After=remote-fs.target
180+
[Service]
181+
ExecStart=/usr/local/bin/nfs-random-write.sh %I
182+
ExecStop=/bin/pkill -9 -P $MAINPID dd
183+
TimeoutStopSec=10s
184+
Type=simple
185+
KillMode=mixed
186+
[Install]
187+
WantedBy=multi-user.target`)
177188
opts := platform.MachineOptions{
178189
MinMemory: 2048,
179190
}
@@ -195,7 +206,7 @@ storage:
195206
// entry point /var/nfs with fsid=0 will be root for clients
196207
// refer to https://access.redhat.com/solutions/107793
197208
_ = c.MustSSHf(nfs_client, `for i in $(seq 4); do
198-
sudo mount -t nfs4 %s:/share$i /var/tmp/data$i
209+
sudo mount -t nfs4 -o soft %s:/share$i /var/mnt/data$i
199210
done`, nfs_server.MachineAddress)
200211

201212
mounts := c.MustSSH(nfs_client, "sudo df -Th | grep nfs | wc -l")
@@ -214,23 +225,20 @@ storage:
214225

215226
func doSyncTest(c cluster.TestCluster, client platform.Machine, m platform.Machine) {
216227
// Do simple touch to make sure nfs server works
217-
c.RunCmdSync(client, "sudo touch /var/tmp/data3/test")
228+
c.RunCmdSync(client, "sudo touch /var/mnt/data3/test")
218229
// Continue writing while doing test
219230
// 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-
}
231+
_, err := c.SSH(client, "sudo systemctl start nfs-random-write@{1..4}.service")
232+
if err != nil {
233+
c.Fatalf("failed to run [email protected]: %v", err)
226234
}
227235

228236
// block NFS traffic on nfs server
229237
c.RunCmdSync(m, "sudo /usr/local/bin/block-nfs.sh")
230238
// Create a stage deploy using kargs while writing
231239
c.RunCmdSync(client, "sudo rpm-ostree kargs --append=test=1")
232240

233-
err := client.Reboot()
241+
err = client.Reboot()
234242
if err != nil {
235243
c.Fatalf("Couldn't reboot machine: %v", err)
236244
}

0 commit comments

Comments
 (0)