Skip to content

Commit

Permalink
clusters general validation was covered with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tengu-alt authored and testisnullus committed Feb 19, 2024
1 parent 6987800 commit 4270cc8
Show file tree
Hide file tree
Showing 2 changed files with 1,206 additions and 6 deletions.
8 changes: 2 additions & 6 deletions apis/clusters/v1beta1/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ func (c *Cluster) ValidateCreation() error {
return fmt.Errorf("two factor delete should not have more than 1 item")
}

if c.Description != "" {
return fmt.Errorf("description is not supported yet, when create a cluster. You can add this field when the cluster is in the running state")
}

if !validation.Contains(c.SLATier, models.SLATiers) {
return fmt.Errorf("cluster SLATier %s is unavailable, available values: %v",
c.SLATier, models.SLATiers)
Expand Down Expand Up @@ -172,7 +168,7 @@ func (cps *CloudProviderSettings) ValidateCreation() error {

func validateReplicationFactor(availableReplicationFactors []int, rf int) error {
if rf <= 0 || rf > 300 {
return fmt.Errorf("replication factor must be a multiple of %v, up to a maximum value of 300",
return fmt.Errorf("replication factor must be one of %v, up to a maximum value of 300",
availableReplicationFactors)
}

Expand All @@ -182,7 +178,7 @@ func validateReplicationFactor(availableReplicationFactors []int, rf int) error
}
}

return fmt.Errorf("replication factor must be a multiple of %v, up to a maximum value of 300",
return fmt.Errorf("replication factor must be one of %v, up to a maximum value of 300",
availableReplicationFactors)
}

Expand Down
Loading

0 comments on commit 4270cc8

Please sign in to comment.