mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-19 09:51:29 +00:00
tests: k8s: k8s-job.bats auto-generated policy
Auto-generate policy for 8s-job.bats. Fixes: #9072 Signed-off-by: Dan Mihai <dmihai@microsoft.com>
This commit is contained in:
parent
41c2bcbdc5
commit
fad7ba0aea
@ -10,13 +10,17 @@ load "${BATS_TEST_DIRNAME}/tests_common.sh"
|
|||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
get_pod_config_dir
|
get_pod_config_dir
|
||||||
|
job_name="job-pi-test"
|
||||||
|
yaml_file="${pod_config_dir}/job.yaml"
|
||||||
|
|
||||||
|
policy_settings_dir="$(create_tmp_policy_settings_dir "${pod_config_dir}")"
|
||||||
|
add_requests_to_policy_settings "${policy_settings_dir}" "ReadStreamRequest"
|
||||||
|
auto_generate_policy "${policy_settings_dir}" "${yaml_file}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "Run a job to completion" {
|
@test "Run a job to completion" {
|
||||||
job_name="job-pi-test"
|
|
||||||
|
|
||||||
# Create job
|
# Create job
|
||||||
kubectl apply -f "${pod_config_dir}/job.yaml"
|
kubectl apply -f "${yaml_file}"
|
||||||
|
|
||||||
# Verify job
|
# Verify job
|
||||||
kubectl describe jobs/"$job_name" | grep "SuccessfulCreate"
|
kubectl describe jobs/"$job_name" | grep "SuccessfulCreate"
|
||||||
@ -45,10 +49,11 @@ teardown() {
|
|||||||
echo "$output"
|
echo "$output"
|
||||||
[[ "$output" =~ "No resources found" ]]
|
[[ "$output" =~ "No resources found" ]]
|
||||||
|
|
||||||
|
|
||||||
kubectl delete jobs/"$job_name"
|
kubectl delete jobs/"$job_name"
|
||||||
# Verify that the job is not running
|
# Verify that the job is not running
|
||||||
run kubectl get jobs
|
run kubectl get jobs
|
||||||
echo "$output"
|
echo "$output"
|
||||||
[[ "$output" =~ "No resources found" ]]
|
[[ "$output" =~ "No resources found" ]]
|
||||||
|
|
||||||
|
delete_tmp_policy_settings_dir "${policy_settings_dir}"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user