Skip to content

Commit

Permalink
Merge pull request #201279 from Homebrew/k8s-heredoc
Browse files Browse the repository at this point in the history
formulae: use `YAML` heredoc delimiter for k8s config files
  • Loading branch information
BrewTestBot authored Dec 15, 2024
2 parents d3725bf 142b1ec commit 4f743ce
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions Formula/k/kor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 26,7 @@ def install
test do
assert_match version.to_s, shell_output("#{bin}/kor version")

(testpath/"mock-kubeconfig").write <<~EOS
(testpath/"mock-kubeconfig").write <<~YAML
apiVersion: v1
clusters:
- cluster:
Expand All @@ -45,7 45,8 @@ def install
- name: kube:admin/mock-server:6443
user:
token: sha256~QTYGVumELfyzLS9H9gOiDhVA2B1VnlsNaRsiztOnae0
EOS
YAML

out = shell_output("#{bin}/kor all -k #{testpath}/mock-kubeconfig 2>&1", 1)
assert_match "Failed to retrieve namespaces: Get \"https://mock-server:6443/api/v1/namespaces\"", out
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/k/kubebuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 45,14 @@ def install
"--skip-go-version-check"
end

assert_match <<~EOS, (testpath/"test/PROJECT").read
assert_match <<~YAML, (testpath/"test/PROJECT").read
domain: my.domain
layout:
- go.kubebuilder.io/v4
projectName: test
repo: example.com
version: "3"
EOS
YAML

assert_match version.to_s, shell_output("#{bin}/kubebuilder version")
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/k/kubesess.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 29,7 @@ def install
end

test do
(testpath/".kube/config").write <<~EOS
(testpath/".kube/config").write <<~YAML
kind: Config
apiVersion: v1
current-context: docker-desktop
Expand All @@ -47,7 47,7 @@ def install
users:
- user:
name: docker-desktop
EOS
YAML

output = shell_output("#{bin}/kubesess -v docker-desktop context 2>&1")
assert_match "docker-desktop", output
Expand Down
4 changes: 2 additions & 2 deletions Formula/k/kubevela.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 36,7 @@ def install
status_output = shell_output("#{bin}/vela up 2>&1", 1)
assert_match "error: either app name or file should be set", status_output

(testpath/"kube-config").write <<~EOS
(testpath/"kube-config").write <<~YAML
apiVersion: v1
clusters:
- cluster:
Expand All @@ -55,7 55,7 @@ def install
- name: test
user:
token: test
EOS
YAML

ENV["KUBECONFIG"] = testpath/"kube-config"
version_output = shell_output("#{bin}/vela version 2>&1")
Expand Down

0 comments on commit 4f743ce

Please sign in to comment.