Helper function to create a test node
(name: &str)
| 10 | |
| 11 | /// Helper function to create a test node |
| 12 | fn create_test_node(name: &str) -> Node { |
| 13 | let mut labels = HashMap::new(); |
| 14 | labels.insert("kubernetes.io/hostname".to_string(), name.to_string()); |
| 15 | |
| 16 | Node { |
| 17 | type_meta: TypeMeta { |
| 18 | kind: "Node".to_string(), |
| 19 | api_version: "v1".to_string(), |
| 20 | }, |
| 21 | metadata: ObjectMeta { |
| 22 | name: name.to_string(), |
| 23 | namespace: None, // Nodes are cluster-scoped |
| 24 | labels: Some(labels), |
| 25 | uid: String::new(), |
| 26 | creation_timestamp: None, |
| 27 | resource_version: None, |
| 28 | finalizers: None, |
| 29 | deletion_timestamp: None, |
| 30 | owner_references: None, |
| 31 | annotations: None, |
| 32 | deletion_grace_period_seconds: None, |
| 33 | generate_name: None, |
| 34 | generation: None, |
| 35 | managed_fields: None, |
| 36 | }, |
| 37 | spec: Some(NodeSpec { |
| 38 | pod_cidr: Some("10.244.0.0/24".to_string()), |
| 39 | pod_cidrs: None, |
| 40 | provider_id: None, |
| 41 | unschedulable: Some(false), |
| 42 | taints: None, |
| 43 | }), |
| 44 | status: Some(NodeStatus { |
| 45 | capacity: None, |
| 46 | allocatable: None, |
| 47 | conditions: Some(vec![NodeCondition { |
| 48 | condition_type: "Ready".to_string(), |
| 49 | status: "True".to_string(), |
| 50 | last_heartbeat_time: Some(chrono::Utc::now()), |
| 51 | last_transition_time: Some(chrono::Utc::now()), |
| 52 | reason: Some("KubeletReady".to_string()), |
| 53 | message: Some("kubelet is posting ready status".to_string()), |
| 54 | }]), |
| 55 | addresses: Some(vec![ |
| 56 | NodeAddress { |
| 57 | address_type: "InternalIP".to_string(), |
| 58 | address: "192.168.1.100".to_string(), |
| 59 | }, |
| 60 | NodeAddress { |
| 61 | address_type: "Hostname".to_string(), |
| 62 | address: name.to_string(), |
| 63 | }, |
| 64 | ]), |
| 65 | node_info: None, |
| 66 | images: None, |
| 67 | volumes_in_use: None, |
| 68 | volumes_attached: None, |
| 69 | daemon_endpoints: None, |
no outgoing calls
no test coverage detected