MCPcopy
hub / github.com/kserve/kserve / TestGetEnvVarValue

Function TestGetEnvVarValue

pkg/utils/utils_test.go:579–612  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

577}
578
579func TestGetEnvVarValue(t *testing.T) {
580 g := gomega.NewGomegaWithT(t)
581 scenarios := map[string]struct {
582 envList []corev1.EnvVar
583 targetEnvName string
584 expectedEnvValue string
585 expectedExist bool
586 }{
587 "EnvExist": {
588 envList: []corev1.EnvVar{
589 {Name: "test-name", Value: "test-value"},
590 },
591 targetEnvName: "test-name",
592 expectedEnvValue: "test-value",
593 expectedExist: true,
594 },
595 "EnvDoesNotExist": {
596 envList: []corev1.EnvVar{
597 {Name: "test-name", Value: "test-value"},
598 },
599 targetEnvName: "wrong",
600 expectedEnvValue: "",
601 expectedExist: false,
602 },
603 }
604
605 for name, scenario := range scenarios {
606 t.Run(name, func(t *testing.T) {
607 res, exists := GetEnvVarValue(scenario.envList, scenario.targetEnvName)
608 g.Expect(res).Should(gomega.Equal(scenario.expectedEnvValue))
609 g.Expect(exists).Should(gomega.Equal(scenario.expectedExist))
610 })
611 }
612}
613
614func TestIsUnknownGpuResourceType(t *testing.T) {
615 g := gomega.NewGomegaWithT(t)

Callers

nothing calls this directly

Calls 2

GetEnvVarValueFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected