Skip to content

Commit 1f84d64

Browse files
HuijingHeitravier
authored andcommitted
test: make ostree.sync + composefs working
Fixes openshift/os#1744
1 parent 22aca49 commit 1f84d64

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

mantle/kola/tests/ostree/sync.go

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,35 @@ var nfs_server_butane = conf.Butane(`variant: fcos
3333
version: 1.5.0
3434
storage:
3535
directories:
36-
- path: /var/nfs1/share
36+
- path: /var/nfs/share1
3737
mode: 0777
38-
- path: /var/nfs2/share
38+
- path: /var/nfs/share2
3939
mode: 0777
40-
- path: /var/nfs3/share
40+
- path: /var/nfs/share3
4141
mode: 0777
42-
- path: /var/nfs4/share
42+
- path: /var/nfs/share4
4343
mode: 0777
44-
- path: /var/nfs5/share
44+
- path: /var/nfs/share5
4545
mode: 0777
46-
- path: /var/nfs6/share
46+
- path: /var/nfs/share6
4747
mode: 0777
4848
files:
4949
- path: "/etc/exports"
5050
overwrite: true
5151
contents:
5252
inline: |
53-
/var/nfs1/share *(rw,insecure,no_root_squash)
54-
/var/nfs2/share *(rw,insecure,no_root_squash)
55-
/var/nfs3/share *(rw,insecure,no_root_squash)
56-
/var/nfs4/share *(rw,insecure,no_root_squash)
57-
/var/nfs5/share *(rw,insecure,no_root_squash)
58-
/var/nfs6/share *(rw,insecure,no_root_squash)
53+
/var/nfs *(rw,no_root_squash,insecure,fsid=0)
54+
/var/nfs/share1 *(rw,no_root_squash,insecure)
55+
/var/nfs/share2 *(rw,no_root_squash,insecure)
56+
/var/nfs/share3 *(rw,no_root_squash,insecure)
57+
/var/nfs/share4 *(rw,no_root_squash,insecure)
58+
/var/nfs/share5 *(rw,no_root_squash,insecure)
59+
/var/nfs/share6 *(rw,no_root_squash,insecure)
5960
- path: "/var/lib/nfs/etab"
61+
user:
62+
name: nfsnobody
63+
group:
64+
name: nfsnobody
6065
systemd:
6166
units:
6267
- name: "nfs-server.service"
@@ -92,7 +97,6 @@ func setupNFSMachine(c cluster.TestCluster) NfsServer {
9297
},
9398
}
9499
options.MinMemory = 2048
95-
96100
// start the machine
97101
switch c := c.Cluster.(type) {
98102
// These cases have to be separated because when put together to the same case statement
@@ -112,8 +116,10 @@ func setupNFSMachine(c cluster.TestCluster) NfsServer {
112116

113117
// Wait for nfs server to become active
114118
err = util.Retry(6, 10*time.Second, func() error {
115-
nfs_status := c.MustSSH(m, "systemctl is-active nfs-server.service")
116-
if string(nfs_status) != "active" {
119+
nfs_status, err := c.SSH(m, "systemctl is-active nfs-server.service")
120+
if err != nil {
121+
return err
122+
} else if string(nfs_status) != "active" {
117123
return fmt.Errorf("nfs-server.service is not ready: %s.", string(nfs_status))
118124
}
119125
return nil
@@ -170,8 +176,7 @@ storage:
170176
sleep 0.5;
171177
done;
172178
done) &
173-
done
174-
`)
179+
done`)
175180
opts := platform.MachineOptions{
176181
MinMemory: 2048,
177182
}
@@ -190,8 +195,10 @@ storage:
190195

191196
// Wait for test machine
192197
err = util.Retry(6, 10*time.Second, func() error {
198+
// entry point /var/nfs with fsid=0 will be root for clients
199+
// refer to https://access.redhat.com/solutions/107793
193200
_ = c.MustSSHf(nfs_client, `for i in $(seq 6); do
194-
sudo mount -t nfs4 %s:/var/nfs$i/share /var/tmp/data$i
201+
sudo mount -t nfs4 %s:/share$i /var/tmp/data$i
195202
done`, nfs_server.MachineAddress)
196203

197204
mounts := c.MustSSH(nfs_client, "sudo df -Th | grep nfs | wc -l")
@@ -210,7 +217,7 @@ storage:
210217

211218
func doSyncTest(c cluster.TestCluster, client platform.Machine) {
212219
c.RunCmdSync(client, "sudo touch /var/tmp/data3/test")
213-
// Continue write
220+
// Continue writing while doing test
214221
go func() {
215222
_, err := c.SSH(client, "sudo sh /usr/local/bin/nfs-random-write.sh")
216223
if err != nil {

0 commit comments

Comments
 (0)