Mohammed Naser | cf511fc | 2025-01-26 12:50:42 -0500 | [diff] [blame] | 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/stretchr/testify/assert" |
| 7 | ) |
| 8 | |
| 9 | func TestGetImageNameToPull(t *testing.T) { |
| 10 | tests := []struct { |
| 11 | image string |
| 12 | release string |
| 13 | want string |
| 14 | }{ |
| 15 | { |
| 16 | image: "{{ atmosphere_image_prefix }}quay.io/ceph/ceph:v18.2.2", |
| 17 | release: "2024.1", |
| 18 | want: "harbor.atmosphere.dev/quay.io/ceph/ceph:v18.2.2", |
| 19 | }, |
| 20 | { |
| 21 | image: "{{ atmosphere_image_prefix }}registry.atmosphere.dev/library/glance:{{ atmosphere_release }}", |
| 22 | release: "2024.1", |
| 23 | want: "harbor.atmosphere.dev/library/glance:2024.1", |
| 24 | }, |
| 25 | } |
| 26 | |
| 27 | for _, tt := range tests { |
| 28 | t.Run(tt.image, func(t *testing.T) { |
| 29 | got := GetImageNameToPull(tt.image, tt.release) |
| 30 | |
| 31 | assert.Equal(t, tt.want, got) |
| 32 | }) |
| 33 | } |
| 34 | } |