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

[jaeger-v2] Add Validation And Comments to Badger Storage Config #5927

Merged
merged 10 commits into from
Sep 5, 2024
Prev Previous commit
Next Next commit
Add Test For Validate Method
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
  • Loading branch information
mahadzaryab1 committed Sep 2, 2024
commit f4ed853b4a1eda40fa12afd71911dcc7348b277b
33 changes: 33 additions & 0 deletions plugin/storage/badger/options_test.go
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import (
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

"github.com/jaegertracing/jaeger/pkg/config"
@@ -53,3 +54,35 @@ func TestReadOnlyOptions(t *testing.T) {
opts.InitFromViper(v, zap.NewNop())
assert.True(t, opts.GetPrimary().ReadOnly)
}

func TestValidate_DoesNotReturnErrorWhenValid(t *testing.T) {
tests := []struct {
name string
config *NamespaceConfig
}{
{
name: "non-required fields not set",
config: &NamespaceConfig{},
},
{
name: "all fields are set",
config: &NamespaceConfig{
SpanStoreTTL: time.Second,
KeyDirectory: "some-key-directory",
ValueDirectory: "some-value-directory",
Ephemeral: false,
SyncWrites: false,
MaintenanceInterval: time.Second,
MetricsUpdateInterval: time.Second,
ReadOnly: false,
},
},
}

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
err := test.config.Validate()
require.NoError(t, err)
})
}
}
Loading