Skip to content

Commit

Permalink
fix(tests): fix tests with dagger
Browse files Browse the repository at this point in the history
  • Loading branch information
jochumdev committed Sep 4, 2024
1 parent f5a4227 commit 38e3f68
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
12 changes: 1 addition & 11 deletions client/tests/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"net/url"
"os"
"path/filepath"
"time"

"github.com/go-orb/go-orb/client"
Expand Down Expand Up @@ -104,9 +103,6 @@ var (
type TestSuite struct {
suite.Suite

// The path of plugins/
PluginsRoot string

// Transports is the list of preferred transports for all requests
Transports []string

Expand All @@ -128,7 +124,6 @@ type TestSuite struct {
func NewSuite(pluginsRoot string, transports []string, requests ...TestRequest) *TestSuite {
s := new(TestSuite)

s.PluginsRoot = pluginsRoot
s.Transports = transports

if len(requests) == 0 {
Expand Down Expand Up @@ -162,11 +157,6 @@ func (s *TestSuite) SetupSuite() {

cURLs := []*url.URL{}

curl, err := url.Parse("file://" + filepath.Join(s.PluginsRoot, "client/tests/cmd/tests_server/config.yaml"))
s.Require().NoError(err, "while parsing a url")

cURLs = append(cURLs, curl)

cfgData, err := config.Read(cURLs, nil)
if err != nil {
s.Require().NoError(err, "while parsing a config")
Expand Down Expand Up @@ -208,7 +198,7 @@ func (s *TestSuite) SetupSuite() {
// WithNumProcesses(5),
// WithRunEnv("GOMAXPROCS=1"),
WithRunEnv("GOMAXPROCS=" + os.Getenv("GOMAXPROCS")),
WithArgs("--config", filepath.Join(s.PluginsRoot, "client/tests/cmd/tests_server/config.yaml")),
WithArgs("--config", "../../cmd/tests_server/config.yaml"),
}
// if logger.Level() <= slog.LevelDebug {
pro = append(pro, WithStdOut(os.Stdout), WithStdErr(os.Stderr))
Expand Down
11 changes: 8 additions & 3 deletions registry/consul/scripts/pre_test.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#!/usr/bin/env bash
set -e; set -o pipefail

# Import util.sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source ${SCRIPT_DIR}/../../../scripts/lib/util.sh

# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
function get_latest_gh_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}

GOOS=$(go env GOOS)
GOARCH=$(go env GOARCH)
Expand All @@ -17,7 +22,7 @@ mkdir -p "${WORKDIR}"
pushd "${WORKDIR}"

if [[ ! -x consul ]]; then
print_msg "Downloading curl ${VERSION}"
echo "Downloading consul ${VERSION}"

curl -s -L https://releases.hashicorp.com/consul/${VERSION}/consul_${VERSION}_${GOOS}_${GOARCH}.zip -o consul.zip
unzip consul.zip 1>/dev/null
Expand Down
11 changes: 8 additions & 3 deletions registry/nats/scripts/pre_test.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#!/usr/bin/env bash
set -e; set -o pipefail

# Import util.sh
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source ${SCRIPT_DIR}/../../../scripts/lib/util.sh

# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
function get_latest_gh_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}

GOOS=$(go env GOOS)
GOARCH=$(go env GOARCH)
Expand All @@ -17,7 +22,7 @@ mkdir -p "${WORKDIR}"
pushd "${WORKDIR}"

if [[ ! -x nats-server ]]; then
print_msg "Downloading NATS ${VERSION}"
echo "Downloading NATS ${VERSION}"

curl -s -L https://github.com/nats-io/nats-server/releases/download/${VERSION}/${ZIPFILE}.zip -o nats.zip
unzip nats.zip "*/nats-server" 1>/dev/null
Expand Down

0 comments on commit 38e3f68

Please sign in to comment.