Some fixes on "same-pod" and volumes + add some tests #82
@@ -1,6 +1,7 @@
|
||||
package generator
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"katenary/generator/labels"
|
||||
"os"
|
||||
@@ -44,3 +45,49 @@ services:
|
||||
t.Errorf("Expected BAR to be baz, got %s", data["BAR"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreateSecretFromEnvironmentWithValue(t *testing.T) {
|
||||
composeFile := `
|
||||
services:
|
||||
web:
|
||||
image: nginx:1.29
|
||||
environment:
|
||||
- FOO=bar
|
||||
- BAR=baz
|
||||
labels:
|
||||
%[1]s/secrets: |-
|
||||
- BAR
|
||||
%[1]s/values: |-
|
||||
- BAR
|
||||
`
|
||||
composeFile = fmt.Sprintf(composeFile, labels.KatenaryLabelPrefix)
|
||||
tmpDir := setup(composeFile)
|
||||
defer teardown(tmpDir)
|
||||
|
||||
currentDir, _ := os.Getwd()
|
||||
os.Chdir(tmpDir)
|
||||
defer os.Chdir(currentDir)
|
||||
|
||||
force := false
|
||||
outputDir := "./chart"
|
||||
profiles := make([]string, 0)
|
||||
helmdepUpdate := true
|
||||
var appVersion *string
|
||||
chartVersion := "0.1.0"
|
||||
convertOptions := ConvertOptions{
|
||||
Force: force,
|
||||
OutputDir: outputDir,
|
||||
Profiles: profiles,
|
||||
HelmUpdate: helmdepUpdate,
|
||||
AppVersion: appVersion,
|
||||
ChartVersion: chartVersion,
|
||||
}
|
||||
Convert(convertOptions, "compose.yml")
|
||||
c, err := os.ReadFile("chart/values.yaml")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !bytes.Contains(c, []byte("BAR: baz")) {
|
||||
t.Errorf("Expected BAR to be baz, got %s", c)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user