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

Add user-specified instrumentation volume #3285

Merged
merged 23 commits into from
Oct 23, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat(vol): add validation unit tests
jnarezo committed Sep 13, 2024
commit 0fbd80d350ec9aee82fbad30a7b2957caa080024
19 changes: 19 additions & 0 deletions apis/v1alpha1/instrumentation_webhook_test.go
Original file line number Diff line number Diff line change
@@ -19,11 +19,15 @@ import (
"testing"

"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/open-telemetry/opentelemetry-operator/internal/config"
)

var defaultVolumeSize = resource.MustParse("200Mi")

func TestInstrumentationDefaultingWebhook(t *testing.T) {
inst := &Instrumentation{}
err := InstrumentationWebhook{
@@ -113,6 +117,21 @@ func TestInstrumentationValidatingWebhook(t *testing.T) {
},
},
},
{
name: "with volume and volumeSizeLimit",
err: "spec.nodejs.volume and spec.nodejs.volumeSizeLimit cannot both be defined",
inst: Instrumentation{
Spec: InstrumentationSpec{
NodeJS: NodeJS{
Volume: corev1.Volume{
Name: "vol1",
},
VolumeSizeLimit: &defaultVolumeSize,
},
},
},
warnings: []string{"sampler type not set"},
},
}

for _, test := range tests {