(t *testing.T)
| 577 | } |
| 578 | |
| 579 | func 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 | |
| 614 | func TestIsUnknownGpuResourceType(t *testing.T) { |
| 615 | g := gomega.NewGomegaWithT(t) |
nothing calls this directly
no test coverage detected