Skip to content

Commit

Permalink
add support for Honeycomb alpha Direct
Browse files Browse the repository at this point in the history
  • Loading branch information
nieomylnieja committed Nov 26, 2024
1 parent 68fcccf commit 08293d7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions manifest/v1alpha/data_sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,13 @@ func DataDogSiteValidationRule() govy.Rule[string] {
"ap1.datadoghq.com")
}

func GetReleaseChannelAlphaEnabledDataSources() []DataSourceType {
return []DataSourceType{
SplunkObservability,
Honeycomb,
}
}

func ptr[T interface{}](val T) *T {
return &val
}
5 changes: 4 additions & 1 deletion manifest/v1alpha/direct/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package direct

import (
"net/url"
"slices"

"github.com/pkg/errors"

Expand Down Expand Up @@ -413,9 +414,11 @@ var queryDelayValidationRule = govy.NewRule(func(spec Spec) error {
return nil
}).WithErrorCode(errCodeQueryDelayOutOfBounds)

var releaseChannelAlphaEnabledDataSources = v1alpha.GetReleaseChannelAlphaEnabledDataSources()

Check failure on line 417 in manifest/v1alpha/direct/validation.go

View workflow job for this annotation

GitHub Actions / Run all checks for static analysis

var `releaseChannelAlphaEnabledDataSources` is unused (unused)

var releaseChannelValidationRule = govy.NewRule(func(spec Spec) error {
typ, _ := spec.GetType()
if typ != v1alpha.SplunkObservability && spec.ReleaseChannel == v1alpha.ReleaseChannelAlpha {
if !slices.Contains(v1alpha.GetReleaseChannelAlphaEnabledDataSources(), typ) {
return govy.NewPropertyError(
"releaseChannel",
spec.ReleaseChannel,
Expand Down
6 changes: 6 additions & 0 deletions manifest/v1alpha/direct/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ func TestValidateSpec_ReleaseChannel(t *testing.T) {
Code: errCodeUnsupportedReleaseChannel,
})
})
t.Run("alpha enabled for Honeycomb", func(t *testing.T) {
direct := validDirect(v1alpha.Honeycomb)
direct.Spec.ReleaseChannel = v1alpha.ReleaseChannelAlpha
err := validate(direct)
testutils.AssertNoError(t, direct, err)
})
}

func TestValidateSpec_QueryDelay(t *testing.T) {
Expand Down

0 comments on commit 08293d7

Please sign in to comment.