Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Alok Kumar Singh <[email protected]>
  • Loading branch information
akstron committed Nov 9, 2024
1 parent ed3e172 commit 07ab247
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pkg/cassandra/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func DefaultConfiguration() Configuration {
DependenciesTTL: 172800,
ReplicationFactor: 1,
CasVersion: 4,
CompactionWindow: "",
CompactionWindow: "1m",
},
Connection: Connection{
Servers: []string{"127.0.0.1"},
Expand Down
21 changes: 11 additions & 10 deletions pkg/cassandra/config/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"bytes"
"embed"
"fmt"
"regexp"
"strconv"
"text/template"

Expand Down Expand Up @@ -67,22 +68,22 @@ func applyDefaults(params *TemplateParams) {
// Applies defaults for the configs and contructs other optional parameters from it
func constructTemplateParams(cfg Schema) (TemplateParams, error) {
params := TemplateParams{
Schema: Schema{},
Schema: cfg,
}
applyDefaults(&params)

params.Replication = fmt.Sprintf("{'class': 'NetworkTopologyStrategy', 'replication_factor': '%v' }", params.ReplicationFactor)

if cfg.CompactionWindow != "" {
if params.CompactionWindow != "" {
var err error
// isMatch, err := regexp.MatchString("[0-9]+[mhd]", params.CompactionWindow)
// if err != nil {
// return TemplateParams{}, err
// }

// if !isMatch {
// return TemplateParams{}, fmt.Errorf("invalid compaction window size format: %s. Please use numeric value followed by 'm' for minutes, 'h' for hours, or 'd' for days", cfg.CompactionWindow)
// }
isMatch, err := regexp.MatchString("[0-9]+[mhd]", params.CompactionWindow)
if err != nil {
return TemplateParams{}, err
}

if !isMatch {
return TemplateParams{}, fmt.Errorf("invalid compaction window size format: %s. Please use numeric value followed by 'm' for minutes, 'h' for hours, or 'd' for days", cfg.CompactionWindow)
}

params.CompactionWindowSize, err = strconv.Atoi(params.CompactionWindow[0 : len(params.CompactionWindow)-1])
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions scripts/cassandra-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ run_integration_test() {
apply_schema "$schema_version" "$archiveKeyspace"
fi

read -n 1

if [ "${jaegerVersion}" = "v1" ]; then
STORAGE=cassandra make storage-integration-test
elif [ "${jaegerVersion}" == "v2" ]; then
Expand Down

0 comments on commit 07ab247

Please sign in to comment.