Skip to content

Commit

Permalink
feat: add initializer envFrom field (#351)
Browse files Browse the repository at this point in the history
* feat: add initializer envFrom field

* test(initializer): add EnvFrom tests
  • Loading branch information
ghostx31 committed Dec 12, 2023
1 parent 6ee0f6c commit 1d97a47
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/resources/jobs/initializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func NewInitializerJob(k6 v1alpha1.TestRunI, argLine string) (*batchv1.Job, erro
Env: env,
Resources: k6.GetSpec().Initializer.Resources,
VolumeMounts: volumeMounts,
EnvFrom: k6.GetSpec().Initializer.EnvFrom,
Ports: ports,
},
},
Expand Down
20 changes: 19 additions & 1 deletion pkg/resources/jobs/initializer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,16 @@ func TestNewInitializerJob(t *testing.T) {
"sh", "-c",
"mkdir -p $(dirname /tmp/test.js.archived.tar) && k6 archive /test/test.js -O /tmp/test.js.archived.tar --out cloud 2> /tmp/k6logs && k6 inspect --execution-requirements /tmp/test.js.archived.tar 2> /tmp/k6logs ; ! cat /tmp/k6logs | grep 'level=error'",
},
Env: []corev1.EnvVar{},
Env: []corev1.EnvVar{},
EnvFrom: []corev1.EnvFromSource{
{
ConfigMapRef: &corev1.ConfigMapEnvSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: "env",
},
},
},
},
Resources: corev1.ResourceRequirements{},
VolumeMounts: script.VolumeMount(),
Ports: []corev1.ContainerPort{{ContainerPort: 6565}},
Expand Down Expand Up @@ -99,6 +108,15 @@ func TestNewInitializerJob(t *testing.T) {
"awesomeAnnotation": "dope",
},
},
EnvFrom: []corev1.EnvFromSource{
{
ConfigMapRef: &corev1.ConfigMapEnvSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: "env",
},
},
},
},
},
},
}
Expand Down

0 comments on commit 1d97a47

Please sign in to comment.