Skip to content

Instantly share code, notes, and snippets.

@hexfusion
Last active October 3, 2025 17:41
Show Gist options
  • Select an option

  • Save hexfusion/f538997dbf8379f4048a5eacf778bb96 to your computer and use it in GitHub Desktop.

Select an option

Save hexfusion/f538997dbf8379f4048a5eacf778bb96 to your computer and use it in GitHub Desktop.
helm install fctl-ocp-ui oci://quay.io/flightctl/flightctl-ocp-ui --version=0.0.1-96-gab2e859
grep 'Completed fetch device' your_log_file.log | grep -E ' [0-9]+(\.[0-9]+)?s"'
bin/flightctl login --insecure-skip-tls-verify https://api.flightctl-rw9.apps.cs-aws-416-cbf72.dev02.red-chesterfield.com --token=<token>
# count total devices in fleet
./bin/flightctl get fleets | awk 'NR>1 {sum+=$NF} END {print sum}'
@hexfusion
Copy link
Author

hexfusion commented Oct 3, 2025

#!/usr/bin/env bash

set -eo pipefail

if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root"
   exit 1
fi

NETWORK_NAME="flightctl"
CONTAINER1_NAME="flightctl-test1"
CONTAINER2_NAME="flightctl-test2"

cleanup() {
  echo -e "\n=== Cleaning up ==="
  podman stop "${CONTAINER1_NAME}" "${CONTAINER2_NAME}" 2>/dev/null || true
  echo "Cleanup complete"
}

setup_network() {
  echo "=== Checking for flightctl network ==="
  if ! podman network exists "${NETWORK_NAME}"; then
    echo "ERROR: Network '${NETWORK_NAME}' does not exist"
    exit 1
  fi
  echo "Network '${NETWORK_NAME}' found"
}

start_containers() {
  echo -e "\n=== Starting container 1 (simulating flightctl service) ==="
  podman run -d \
    --name "${CONTAINER1_NAME}" \
    --network "${NETWORK_NAME}" \
    --rm \
    quay.io/fedora/fedora:latest \
    python3 -m http.server 80

  echo -e "\n=== Starting container 2 (simulating agent) ==="
  podman run -d \
    --name "${CONTAINER2_NAME}" \
    --network "${NETWORK_NAME}" \
    --rm \
    quay.io/fedora/fedora:latest \
    python3 -m http.server 80
}

test_connectivity() {
  echo -e "\n=== Testing connectivity from container1 to container2 ==="
  podman exec "${CONTAINER1_NAME}" \
    curl -s --max-time 5 "http://${CONTAINER2_NAME}:80" \
    && echo "SUCCESS: Can reach ${CONTAINER2_NAME}" \
    || echo "Connection test complete"

  echo -e "\n=== Testing connectivity from container2 to container1 ==="
  podman exec "${CONTAINER2_NAME}" \
    curl -s --max-time 5 "http://${CONTAINER1_NAME}:80" \
    && echo "SUCCESS: Can reach ${CONTAINER1_NAME}" \
    || echo "Connection test complete (no service running"
}

inspect_network() {
  echo -e "\n=== Network inspection ==="
  podman network inspect "${NETWORK_NAME}"
}

check_proxy_settings() {
  echo -e "\n=== Proxy settings in container1 ==="
  podman exec "${CONTAINER1_NAME}" env | grep -i proxy \
    || echo "No proxy settings found"

  echo -e "\n=== Proxy settings in container2 ==="
  podman exec "${CONTAINER2_NAME}" env | grep -i proxy \
    || echo "No proxy settings found"
}

trap cleanup EXIT

setup_network
start_containers
test_connectivity
inspect_network
check_proxy_settings

echo -e "\n=== Test complete ==="

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment