Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(spc): Fix the test related to the PR #1597 #1602

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pkg/storagepoolclaim/v1alpha1/storagepoolclaim.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,20 @@ func (l predicateList) all(c *SPC) bool {
}

// IsOverProvisioningEnabled returns OverProvisioning truth value.
// OverProvisioning field is deprecated and not honoured
func IsOverProvisioningEnabled() Predicate {
return func(spc *SPC) bool {
return spc.Object.Spec.PoolSpec.OverProvisioning
}
}

// IsThickProvisioningEnabled returns ThickProvisioning truth value.
func IsThickProvisioningEnabled() Predicate {
return func(spc *SPC) bool {
return spc.Object.Spec.PoolSpec.ThickProvisioning
}
}

// HasAnnotation returns true if provided annotation key and value are present in the provided spc instance.
func HasAnnotation(key, value string) Predicate {
return func(c *SPC) bool {
Expand Down Expand Up @@ -265,6 +273,12 @@ func (sb *Builder) WithOverProvisioning(val bool) *Builder {
return sb
}

// WithThickProvisioning sets the ThickProvisioning field of spc with provided argument value.
func (sb *Builder) WithThickProvisioning(val bool) *Builder {
sb.Spc.Object.Spec.PoolSpec.ThickProvisioning = val
return sb
}

// WithPool sets the poolType field of spc with provided argument value.
func (sb *Builder) WithPool(poolType string) *Builder {
sb.Spc.Object.Spec.PoolSpec.PoolType = poolType
Expand Down
2 changes: 1 addition & 1 deletion tests/admission/admission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var _ = Describe("[cstor] TEST ADMISSION SERVER VALIDATION", func() {
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(cstor.PoolCount).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeStripedCPV)).
Build().Object

Expand Down
2 changes: 1 addition & 1 deletion tests/cstor/clone/clone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var _ = Describe("[cstor] TEST VOLUME CLONE PROVISIONING", func() {
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(cstor.PoolCount).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeStripedCPV)).
Build().Object

Expand Down
2 changes: 1 addition & 1 deletion tests/cstor/node-selector/volume_selector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var _ = Describe("[cstor] TEST VOLUME PROVISIONING USING TARGET AND REPLICA SELE
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(cstor.PoolCount).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeStripedCPV)).
Build().Object

Expand Down
6 changes: 3 additions & 3 deletions tests/cstor/pool/negative/invalid_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var _ = Describe("[cstor] [-ve] TEST INVALID STORAGEPOOLCLAIM", func() {
WithGenerateName(spcName).
WithDiskType("invalid-disk-type").
WithMaxPool(cstor.PoolCount).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeStripedCPV)).
Build().Object

Expand All @@ -73,7 +73,7 @@ var _ = Describe("[cstor] [-ve] TEST INVALID STORAGEPOOLCLAIM", func() {
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(cstor.PoolCount).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string("invalid-pool-type")).
Build().Object

Expand All @@ -96,7 +96,7 @@ var _ = Describe("[cstor] [-ve] TEST INVALID STORAGEPOOLCLAIM", func() {
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(-1).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeStripedCPV)).
Build().Object

Expand Down
2 changes: 1 addition & 1 deletion tests/cstor/pool/negative/invalid_storageclass_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var _ = Describe("[cstor] [-ve] TEST INVALID STORAGECLASS", func() {
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(cstor.PoolCount).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeStripedCPV)).
Build().Object

Expand Down
2 changes: 1 addition & 1 deletion tests/cstor/pool/negative/provision_without_disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var _ = Describe("[cstor] [-ve] TEST PROVISION WITHOUT DISK", func() {
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(cstor.PoolCount).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeStripedCPV)).
Build().Object

Expand Down
10 changes: 5 additions & 5 deletions tests/cstor/pool/negative/provision_without_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ var _ = Describe("[cstor] [-ve] TEST PROVISION WITHOUT POOL", func() {
BeforeEach(func() {
By("creating storagepoolclaim")
spcConfig := &tests.SPCConfig{
Name: spcName,
DiskType: "sparse",
PoolCount: cstor.PoolCount,
IsOverProvisioning: false,
PoolType: "striped",
Name: spcName,
DiskType: "sparse",
PoolCount: cstor.PoolCount,
IsThickProvisioning: true,
PoolType: "striped",
}
ops.Config = spcConfig
spcObj = ops.BuildAndCreateSPC()
Expand Down
8 changes: 4 additions & 4 deletions tests/cstor/pool/reconciliation/reconciliation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var _ = Describe("STRIPED SPARSE SPC", func() {
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(3).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeStripedCPV)).
Build()
spcObj = Spc.Object
Expand Down Expand Up @@ -211,7 +211,7 @@ var _ = Describe("MIRRORED SPARSE SPC", func() {
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(3).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeMirroredCPV)).
Build().Object

Expand Down Expand Up @@ -280,7 +280,7 @@ var _ = Describe("RAIDZ SPARSE SPC", func() {
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(3).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeRaidzCPV)).
Build().Object

Expand Down Expand Up @@ -355,7 +355,7 @@ var _ = Describe("RAIDZ2 SPARSE SPC", func() {
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(3).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeRaidz2CPV)).
Build().Object

Expand Down
2 changes: 1 addition & 1 deletion tests/cstor/snapshot/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var _ = Describe("[cstor] TEST SNAPSHOT PROVISIONING", func() {
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(cstor.PoolCount).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeStripedCPV)).
Build().Object

Expand Down
2 changes: 1 addition & 1 deletion tests/cstor/volume/provision_bulk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var _ = Describe("[Cstor Volume Provisioning Positive] TEST BULK VOLUME PROVISIO
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(cstor.PoolCount).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeStripedCPV)).
Build().Object

Expand Down
10 changes: 5 additions & 5 deletions tests/cstor/volume/provision_negative_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ var _ = Describe("[Cstor Volume Provisioning Negative] Volume Provisioning", fun
By("Build And Create StoragePoolClaim object")
// Populate configurations and create
spcConfig := &tests.SPCConfig{
Name: spcName,
DiskType: "sparse",
PoolCount: cstor.PoolCount,
IsOverProvisioning: false,
PoolType: "striped",
Name: spcName,
DiskType: "sparse",
PoolCount: cstor.PoolCount,
IsThickProvisioning: true,
PoolType: "striped",
}
ops.Config = spcConfig
spcObj = ops.BuildAndCreateSPC()
Expand Down
2 changes: 1 addition & 1 deletion tests/cstor/volume/provision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var _ = Describe("[Cstor Volume Provisioning Positive] TEST VOLUME PROVISIONING"
WithGenerateName(spcName).
WithDiskType(string(apis.TypeSparseCPV)).
WithMaxPool(cstor.PoolCount).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeStripedCPV)).
Build().Object

Expand Down
10 changes: 5 additions & 5 deletions tests/cstor/volume/replica_replace/replica_replace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ var _ = Describe("[REPLICA REPLACE] CSTOR REPLICA REPLACE", func() {
By("Build And Create StoragePoolClaim object")
// Populate configurations and create
spcConfig := &tests.SPCConfig{
Name: spcName,
DiskType: "sparse",
PoolCount: cstor.PoolCount,
IsOverProvisioning: false,
PoolType: "striped",
Name: spcName,
DiskType: "sparse",
PoolCount: cstor.PoolCount,
IsThickProvisioning: true,
PoolType: "striped",
}
ops.Config = spcConfig
spcObj = ops.BuildAndCreateSPC()
Expand Down
10 changes: 5 additions & 5 deletions tests/cstor/volume/scaleup_replica/scaleup_replica_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ var _ = Describe("[REPLICA SCALEUP/SCALEDOWN] CSTOR REPLICA SCALEUP And SCALEDOW
By("Build And Create StoragePoolClaim object")
// Populate configurations and create
spcConfig := &tests.SPCConfig{
Name: spcName,
DiskType: "sparse",
PoolCount: cstor.PoolCount,
IsOverProvisioning: false,
PoolType: "striped",
Name: spcName,
DiskType: "sparse",
PoolCount: cstor.PoolCount,
IsThickProvisioning: true,
PoolType: "striped",
}
ops.Config = spcConfig
spcObj = ops.BuildAndCreateSPC()
Expand Down
2 changes: 1 addition & 1 deletion tests/exporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var _ = Describe("Test maya-exporter [single-pool-pod]", func() {
WithName(spcName).
WithDiskType(string(apis.TypeBlockDeviceCPV)).
WithMaxPool(1).
WithOverProvisioning(false).
WithThickProvisioning(true).
WithPoolType(string(apis.PoolTypeStripedCPV)).
Build().Object

Expand Down
13 changes: 8 additions & 5 deletions tests/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,14 @@ type Operations struct {

// SPCConfig provides config to create cstor pools
type SPCConfig struct {
Name string
DiskType string
PoolType string
PoolCount int
Name string
DiskType string
PoolType string
PoolCount int
// OverProvisioning field is deprecated and not honoured
IsOverProvisioning bool

IsThickProvisioning bool
}

// SCConfig provides config to create storage class
Expand Down Expand Up @@ -1082,7 +1085,7 @@ func (ops *Operations) BuildAndCreateSPC() *apis.StoragePoolClaim {
WithGenerateName(spcConfig.Name).
WithDiskType(spcConfig.DiskType).
WithMaxPool(spcConfig.PoolCount).
WithOverProvisioning(spcConfig.IsOverProvisioning).
WithThickProvisioning(spcConfig.IsThickProvisioning).
WithPoolType(spcConfig.PoolType).
Build().Object
newSPCObj, err := ops.SPCClient.Create(spcObj)
Expand Down