Skip to content

Commit da5e6f5

Browse files
committed
Fix spec issues
Signed-off-by: Rafal Lal <rafal.lal@tietoevry.com>
1 parent 08cbe81 commit da5e6f5

5 files changed

Lines changed: 12 additions & 9 deletions

File tree

src/modules/cluster_tools/cluster_tools.cr

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,13 @@ module ClusterTools
6666
File.write("cluster_tools.yml", ManifestTemplate.new().to_s)
6767
end
6868

69-
KubectlClient::Delete.file("cluster_tools.yml", namespace: self.namespace!)
70-
#todo make this work with cluster-tools-host-namespace
71-
KubectlClient::Wait.resource_wait_for_uninstall("Daemonset", "cluster-tools", namespace: self.namespace!)
69+
begin
70+
KubectlClient::Delete.file("cluster_tools.yml", namespace: self.namespace!)
71+
#todo make this work with cluster-tools-host-namespace
72+
KubectlClient::Wait.resource_wait_for_uninstall("Daemonset", "cluster-tools", namespace: self.namespace!)
73+
rescue ex : KubectlClient::ShellCMD::NotFoundError
74+
Log.info { "ClusterTools not present on the cluster" }
75+
end
7276
end
7377

7478
def self.exec(cli : String) : KubectlClient::CMDResult

src/modules/k8s_netstat/k8s_netstat.cr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ module Netstat
117117
local_address: String,
118118
foreign_address: String,
119119
state: String)) do |acc, x|
120-
ignored_ip = all_service_pod_ips[0]["pod_ips"].find { |i| x[:foreign_address].includes?(i["ip"].as_s) }
120+
next acc if all_service_pod_ips.first?.nil?
121+
ignored_ip = all_service_pod_ips.first["pod_ips"].find { |i| x[:foreign_address].includes?(i["ip"].as_s) }
121122
if ignored_ip
122123
Log.info { "dont add: #{x[:foreign_address]}" }
123124
acc

src/modules/kubectl_client/constants.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ module KubectlClient
1010
# kubectl CMD errors
1111
ALREADY_EXISTS_ERR_MATCH = "AlreadyExists"
1212
NOT_FOUND_ERR_MATCH = "NotFound|does not exist"
13-
NETWORK_ERR_MATCH = "Unable to connect to the server|connection refused"
13+
NETWORK_ERR_MATCH = "Unable to connect to the server|connection refused|request timed out"
1414
end

src/tasks/cleanup.cr

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ desc "Cleans up the CNF Test Suite helper tools and containers"
1616
task "tools_uninstall", [
1717
"_tools_uninstall_start",
1818
"setup:uninstall_sonobuoy",
19-
"setup:uninstall_chaosmesh",
2019
"setup:uninstall_litmus",
21-
"setup:uninstall_dockerd",
2220
"setup:uninstall_kubescape",
2321
"setup:uninstall_cluster_tools",
2422
"setup:uninstall_opa",
@@ -31,7 +29,7 @@ task "tools_uninstall", [
3129
end
3230

3331
desc "Cleans up the CNF Test Suite sample projects, helper tools, and containers"
34-
task "uninstall_all", ["cnf_uninstall", "tools_uninstall"] do |_, args|
32+
task "uninstall_all", ["setup:cnf_uninstall", "tools_uninstall"] do |_, args|
3533
end
3634

3735
task "delete_results" do |_, args|

src/tasks/setup/sonobuoy_setup.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ task "uninstall_sonobuoy" do |_, args|
5555
shell: true,
5656
output: stdout = IO::Memory.new,
5757
error: stderr = IO::Memory.new
58-
)
58+
) if File.exists?(sonobuoy)
5959
Log.debug { stdout }
6060
FileUtils.rm_rf("#{tools_path}/sonobuoy")
6161
end

0 commit comments

Comments
 (0)