Skip to content

Commit ebdc6e3

Browse files
phlogistonjohnobnoxxx
authored andcommitted
integration tests: test SmbShares enabling grouping and clustering
The existing tests only checked that share grouping functioned with simple single-server deployment based instances. This new test case checks that the combination of the ctdb enabled clustering mode and explicit grouping mode works. Signed-off-by: John Mulligan <[email protected]>
1 parent 4b24993 commit ebdc6e3

File tree

4 files changed

+101
-1
lines changed

4 files changed

+101
-1
lines changed

tests/files/cross-pvc2.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
apiVersion: v1
3+
kind: PersistentVolumeClaim
4+
metadata:
5+
name: cross-pvc2
6+
spec:
7+
accessModes:
8+
- ReadWriteMany
9+
resources:
10+
requests:
11+
storage: 100Mi
12+
volumeMode: Filesystem

tests/files/cross-share1ctdb.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
apiVersion: samba-operator.samba.org/v1alpha1
3+
kind: SmbShare
4+
metadata:
5+
name: cross-share1ctdb
6+
annotations:
7+
samba-operator.samba.org/node-spread: "false"
8+
spec:
9+
shareName: "Ecks Cee One"
10+
readOnly: false
11+
browseable: true
12+
securityConfig: sharesec1
13+
scaling:
14+
availabilityMode: clustered
15+
minClusterSize: 3
16+
groupMode: explicit
17+
group: cross-clust
18+
storage:
19+
pvc:
20+
name: cross-pvc2
21+
path: one

tests/files/cross-share2ctdb.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
apiVersion: samba-operator.samba.org/v1alpha1
3+
kind: SmbShare
4+
metadata:
5+
name: cross-share2ctdb
6+
annotations:
7+
samba-operator.samba.org/node-spread: "false"
8+
spec:
9+
shareName: "Ecks Cee Two"
10+
readOnly: false
11+
browseable: true
12+
securityConfig: sharesec1
13+
scaling:
14+
availabilityMode: clustered
15+
minClusterSize: 3
16+
groupMode: explicit
17+
group: cross-clust
18+
storage:
19+
pvc:
20+
name: cross-pvc2
21+
path: two

tests/integration/grouped_test.go

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (s *GroupedSharesSuite) SetupTest() {
8080
defer cancel()
8181
s.serverGroupName = s.getServerGroupName(ctx)
8282
require.NoError(waitForPodExist(ctx, s), "smb server pod does not exist")
83-
require.NoError(waitForPodReady(ctx, s), "smb server pod is not ready")
83+
require.NoError(waitForAllPodReady(ctx, s), "smb server pod is not ready")
8484
}
8585

8686
func (s *GroupedSharesSuite) TearDownSuite() {
@@ -666,4 +666,50 @@ func init() {
666666
},
667667
destNamespace: testNamespace,
668668
})
669+
if testClusteredShares {
670+
groupedSharesTest.AddSuite("clustered", &GroupedSharesSuite{
671+
commonSources: []kube.FileSource{
672+
{
673+
Path: path.Join(testFilesDir, "userssecret1.yaml"),
674+
Namespace: testNamespace,
675+
},
676+
{
677+
Path: path.Join(testFilesDir, "smbsecurityconfig1.yaml"),
678+
Namespace: testNamespace,
679+
},
680+
{
681+
Path: path.Join(testFilesDir, "cross-pvc2.yaml"),
682+
Namespace: testNamespace,
683+
},
684+
},
685+
smbShareSources: []kube.FileSource{
686+
{
687+
Path: path.Join(testFilesDir, "cross-share1ctdb.yaml"),
688+
Namespace: testNamespace,
689+
},
690+
{
691+
Path: path.Join(testFilesDir, "cross-share2ctdb.yaml"),
692+
Namespace: testNamespace,
693+
},
694+
},
695+
toDelete: []types.NamespacedName{
696+
{Namespace: testNamespace, Name: "cross-share2ctdb"},
697+
},
698+
phaseOneShareNames: []string{
699+
"Ecks Cee One",
700+
"Ecks Cee Two",
701+
},
702+
phaseTwoShareNames: []string{
703+
"Ecks Cee One",
704+
},
705+
goneShareName: "Ecks Cee Two", // only specify one share that was removed
706+
testAuths: []smbclient.Auth{{
707+
Username: "sambauser",
708+
Password: "1nsecurely",
709+
}},
710+
destNamespace: testNamespace,
711+
maxPods: 3,
712+
minPods: 2,
713+
})
714+
}
669715
}

0 commit comments

Comments
 (0)