|
1 | 1 | package pullsecret |
2 | 2 |
|
3 | 3 | import ( |
| 4 | + "bytes" |
4 | 5 | "context" |
5 | 6 | "encoding/base64" |
| 7 | + "github.com/loft-sh/devspace/pkg/devspace/config/versions/latest" |
6 | 8 | "github.com/onsi/ginkgo/v2" |
| 9 | + "gopkg.in/yaml.v3" |
7 | 10 | "os" |
8 | 11 | "sort" |
9 | 12 |
|
@@ -96,4 +99,28 @@ var _ = DevSpaceDescribe("pullsecret", func() { |
96 | 99 | framework.ExpectEqual(serviceAccount.ImagePullSecrets[1].Name, "merged-secret") |
97 | 100 | framework.ExpectEqual(serviceAccount.ImagePullSecrets[2].Name, "test-secret") |
98 | 101 | }) |
| 102 | + |
| 103 | + ginkgo.It("should create pullsecrets for v1beta11 images", func() { |
| 104 | + tempDir, err := framework.CopyToTempDir("tests/pullsecret/testdata/v1-upgrade") |
| 105 | + framework.ExpectNoError(err) |
| 106 | + defer framework.CleanupTempDir(initialDir, tempDir) |
| 107 | + |
| 108 | + // create a new print command |
| 109 | + configBuffer := &bytes.Buffer{} |
| 110 | + printCmd := &cmd.PrintCmd{ |
| 111 | + GlobalFlags: &flags.GlobalFlags{}, |
| 112 | + Out: configBuffer, |
| 113 | + SkipInfo: true, |
| 114 | + } |
| 115 | + |
| 116 | + err = printCmd.Run(f) |
| 117 | + framework.ExpectNoError(err) |
| 118 | + |
| 119 | + latestConfig := &latest.Config{} |
| 120 | + err = yaml.Unmarshal(configBuffer.Bytes(), latestConfig) |
| 121 | + framework.ExpectNoError(err) |
| 122 | + framework.ExpectEqual(len(latestConfig.PullSecrets), 2) |
| 123 | + framework.ExpectEqual(latestConfig.PullSecrets["app"].Registry, "registry1.example.com") |
| 124 | + framework.ExpectEqual(latestConfig.PullSecrets["skip"].Registry, "registry2.example.com") |
| 125 | + }) |
99 | 126 | }) |
0 commit comments