Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mruoss committed Aug 22, 2024
1 parent 4b45a0d commit d024d68
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added

- Support for binary BYO runner pod templates
- Support for BYO runner pod templates as map.

## [0.4.2] - 2024-07-28

### Fixed
### Fixed

- SSL cert verification workaround for older OTP versions was added again - [#37](https://github.com/mruoss/flame_k8s_backend/issues/37) [#38](https://github.com/mruoss/flame_k8s_backend/pull/38)
- Upgraded FLAME dependency to `0.3.0`
Expand Down
29 changes: 24 additions & 5 deletions test/flame_k8s_backend/runner_pod_template_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,30 @@ defmodule FLAMEK8sBackend.RunnerPodTemplateTest do
end
end

describe "manifest/2 with map" do
test "Uses fields defined in pod template", %{
parent_pod_manifest_full: parent_pod_manifest
} do
pod_template = ~y"""
apiVersion: v1
kind: Pod
metadata:
namespace: default
spec:
containers:
- name: runner
resources:
requests:
cpu: "1"
"""

pod_manifest = MUT.manifest(parent_pod_manifest, pod_template, make_ref())

assert get_in(pod_manifest, app_container_access(~w(name))) == "runner"
assert get_in(pod_manifest, app_container_access(~w(resources requests cpu))) == "1"
end
end

describe "manifest/2 with empty %RunnerPodTemplate{} struct" do
test "Uses parent pod's values for empty template opts", %{
parent_pod_manifest_full: parent_pod_manifest
Expand All @@ -168,11 +192,6 @@ defmodule FLAMEK8sBackend.RunnerPodTemplateTest do
pod_manifest = MUT.manifest(parent_pod_manifest, template_opts, ref)

assert get_in(pod_manifest, app_container_access(~w(resources requests memory))) == "100Mi"
assert get_in(pod_manifest, env_var_access("POD_NAMESPACE")) == ["test-namespace"]

assert [<<"flame-cb76858b7-", _::binary>>] =
get_in(pod_manifest, env_var_access("POD_NAME"))

assert get_in(pod_manifest, env_var_access("PHX_SERVER")) == ["false"]
parent = flame_parent(pod_manifest)
assert parent.ref == ref
Expand Down

0 comments on commit d024d68

Please sign in to comment.