Skip to content

Commit

Permalink
Fix etcd download on darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
szajbus committed May 4, 2023
1 parent aa91bb7 commit c9b3a3e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ etcdex-*.tar
# Etcd db files
/default.etcd

# Etcd
test/bin

### Vim
# Swap
[._]*.s[a-v][a-z]
Expand Down
17 changes: 10 additions & 7 deletions test/support/etcd_helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule EtcdHelper do
"""

@github_url "https://github.com/etcd-io/etcd/releases/download"
@etcd_version "v3.5.4"
@etcd_version "v3.5.8"

@open_port_opts [:exit_status, :binary, :stream, :stderr_to_stdout]

Expand All @@ -29,15 +29,14 @@ defmodule EtcdHelper do
download_darwin_etcd()
end

{"test/bin/etcd", "test/bin/etcdctl"}

etcd_executable ->
{etcd_executable, System.find_executable("etcdctl")}
end
end

def download_linux_etcd do
filename = "etcd-#{@etcd_version}-linux-#{arch()}.tar.gz"
basename = "etcd-#{@etcd_version}-linux-#{arch()}"
filename = "#{basename}.tar.gz"

if not File.exists?("test/bin/#{filename}") do
url = "#{@github_url}/#{@etcd_version}/#{filename}"
Expand All @@ -56,14 +55,16 @@ defmodule EtcdHelper do
"xzvf",
"test/bin/#{filename}",
"-C",
"test/bin",
"--strip-components=1"
"test/bin"
])
end

{"test/bin/#{basename}/etcd", "test/bin/#{basename}/etcdctl"}
end

def download_darwin_etcd do
filename = "etcd-#{@etcd_version}-darwin-#{arch()}.zip"
basename = "etcd-#{@etcd_version}-darwin-#{arch()}"
filename = "#{basename}.zip"

if not File.exists?("test/bin/#{filename}") do
url = "#{@github_url}/#{@etcd_version}/#{filename}"
Expand All @@ -84,6 +85,8 @@ defmodule EtcdHelper do
"test/bin"
])
end

{"test/bin/#{basename}/etcd", "test/bin/#{basename}/etcdctl"}
end

def arch do
Expand Down

0 comments on commit c9b3a3e

Please sign in to comment.