feat/fleet-e2e-harness-and-ping #286
@@ -6,3 +6,6 @@ rustflags = ["-C", "link-arg=-Wl,--stack,8000000"]
|
||||
|
||||
[target.aarch64-unknown-linux-gnu]
|
||||
linker = "aarch64-linux-gnu-gcc"
|
||||
|
||||
[profile.test]
|
||||
debug = 0
|
||||
|
||||
@@ -10,9 +10,30 @@ jobs:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: hub.nationtech.io/harmony/harmony_composer:latest
|
||||
options: --network host
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install kubectl
|
||||
run: |
|
||||
KUBECTL_VERSION=v1.31.5
|
||||
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
|
||||
chmod +x kubectl
|
||||
mv kubectl /usr/local/bin/kubectl
|
||||
kubectl version --client
|
||||
|
||||
- name: Run check script
|
||||
run: bash build/check.sh
|
||||
|
||||
- name: Debug kube connectivity
|
||||
if: always()
|
||||
run: |
|
||||
echo "PATH=$PATH"
|
||||
kubectl config current-context || true
|
||||
kubectl config view --minify --raw || true
|
||||
kubectl cluster-info || true
|
||||
kubectl get nodes -v=8 || true
|
||||
docker ps || true
|
||||
|
||||
|
||||
@@ -174,6 +174,7 @@ mod tests {
|
||||
#[cfg(feature = "reqwest")]
|
||||
mod download_tests {
|
||||
use super::*;
|
||||
use crate::ChecksumAlgo;
|
||||
use httptest::{Expectation, Server, matchers::request, responders::*};
|
||||
|
||||
fn test_asset_with_url(url: &str, checksum: &str) -> Asset {
|
||||
|
||||
@@ -220,6 +220,7 @@ impl K3d {
|
||||
debug!("Initializing k3d cluster '{}'", cluster_name);
|
||||
|
||||
self.create_cluster(cluster_name)?;
|
||||
self.ensure_k3d_config_is_default(cluster_name)?;
|
||||
self.create_kubernetes_client().await
|
||||
}
|
||||
|
||||
@@ -263,12 +264,11 @@ impl K3d {
|
||||
client = self.initialize_cluster().await?;
|
||||
} else {
|
||||
self.start_cluster().await?;
|
||||
|
||||
self.ensure_k3d_config_is_default(self.get_cluster_name()?)?;
|
||||
debug!("K3d and cluster are already properly set up");
|
||||
client = self.create_kubernetes_client().await?;
|
||||
}
|
||||
|
||||
self.ensure_k3d_config_is_default(self.get_cluster_name()?)?;
|
||||
Ok(client)
|
||||
}
|
||||
|
||||
@@ -400,8 +400,20 @@ impl K3d {
|
||||
}
|
||||
|
||||
fn ensure_k3d_config_is_default(&self, cluster_name: &str) -> Result<(), String> {
|
||||
let home = std::env::var("HOME").unwrap_or_else(|_| "/root".to_string());
|
||||
std::fs::create_dir_all(format!("{home}/.kube"))
|
||||
.map_err(|e| format!("Failed to create ~/.kube dir: {}", e))?;
|
||||
let output = self.run_k3d_command(["kubeconfig", "merge", "-d", cluster_name])?;
|
||||
|
||||
log::debug!(
|
||||
"k3d kubeconfig merge stdout: {}",
|
||||
String::from_utf8_lossy(&output.stdout)
|
||||
);
|
||||
log::debug!(
|
||||
"k3d kubeconfig merge stderr: {}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
);
|
||||
|
||||
if !output.status.success() {
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
return Err(format!("Failed to setup k3d kubeconfig : {}", stderr));
|
||||
|
||||
Reference in New Issue
Block a user