github.com/kata-containers/tests@v0.0.0-20240307153542-772105b56064/integration/kubernetes/k8s-inotify.bats (about)

     1  #!/usr/bin/env bats
     2  #
     3  # Copyright (c) 2021 Apple Inc.
     4  #
     5  # SPDX-License-Identifier: Apache-2.0
     6  #
     7  
     8  load "${BATS_TEST_DIRNAME}/../../.ci/lib.sh"
     9  load "${BATS_TEST_DIRNAME}/tests_common.sh"
    10  
    11  setup() {
    12  	[ "${KATA_HYPERVISOR}" == "firecracker" ] && skip "test not working see: ${fc_limitations}"
    13  	get_pod_config_dir
    14  }
    15  
    16  @test "configmap update works, and preserves symlinks" {
    17          pod_name="inotify-configmap-testing"
    18  
    19          # Create configmap for my deployment
    20          kubectl apply -f "${pod_config_dir}"/inotify-configmap.yaml
    21  
    22          # Create deployment that expects identity-certs
    23          kubectl apply -f "${pod_config_dir}"/inotify-configmap-pod.yaml
    24          kubectl wait --for=condition=Ready --timeout=$timeout pod "$pod_name"
    25  
    26          # Update configmap
    27          kubectl apply -f "${pod_config_dir}"/inotify-updated-configmap.yaml
    28  
    29          # Ideally we'd wait for the pod to complete...
    30          sleep 120
    31  
    32          # Verify we saw the update
    33          result=$(kubectl get pod "$pod_name" --output="jsonpath={.status.containerStatuses[]}")
    34          echo $result | grep -vq Error
    35  
    36          kubectl delete configmap cm
    37  }
    38  
    39  
    40  
    41  teardown() {
    42  	[ "${KATA_HYPERVISOR}" == "firecracker" ] && skip "test not working see: ${fc_limitations}"
    43  	# Debugging information
    44  	kubectl describe "pod/$pod_name"
    45  	kubectl delete pod "$pod_name"
    46  }