Skip to content

Commit 1147f71

Browse files
Split unit tests
Signed-off-by: sougata-progress <sougatab@progress.com>
1 parent 8d285c0 commit 1147f71

3 files changed

Lines changed: 103 additions & 24 deletions

File tree

.expeditor/scripts/verify/run_cargo_test.sh

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,12 @@
22

33
set -eou pipefail
44

5-
# Platform-specific setup before sourcing shared.sh
5+
# Set up writable HAB_ROOT_PATH on macOS BEFORE sourcing shared.sh to avoid read-only filesystem issues
66
if [[ "$OSTYPE" == "darwin"* ]]; then
7-
# Set up temporary HAB_ROOT_PATH for macOS to avoid permission issues
87
export HAB_ROOT_PATH
98
HAB_ROOT_PATH=$(mktemp -d /tmp/hab-root-XXXXXX)
10-
119
# Clean up Darwin-specific temp directory on exit
1210
trap 'rm -rf "$HAB_ROOT_PATH"' EXIT
13-
14-
# Accept habitat license via environment variable to avoid sudo issues
15-
export HAB_LICENSE="accept-no-persist"
1611
fi
1712

1813
# shellcheck source=.expeditor/scripts/shared.sh
@@ -50,15 +45,37 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
5045
brew install coreutils gnu-tar
5146
fi
5247

48+
# Install hab and bootstrap package for certificate extraction
49+
if ! command -v hab &> /dev/null; then
50+
echo "Installing hab via curlbash..."
51+
curlbash_hab "x86_64-darwin"
52+
fi
53+
54+
echo "Installing bootstrap package for GNU tools..."
55+
macos_install_bootstrap_package
56+
57+
# Accept habitat license after hab is installed and HAB_ROOT_PATH is set
58+
sudo -E hab license accept
59+
5360
# Set up certificate file for TLS tests using macOS approach
54-
# Temporarily add GNU tools to PATH for the certificate function
61+
# Temporarily modify PATH to prioritize GNU tools over BSD tools
5562
brew_prefix=$(brew --prefix)
56-
export PATH="/usr/local/bin:${brew_prefix}/bin:$PATH"
57-
# Create aliases for the certificate extraction function
58-
alias tail=gtail
59-
alias tar=gtar
63+
gnu_coreutils_bin="${brew_prefix}/bin"
64+
gnu_tar_bin="${brew_prefix}/bin"
65+
original_PATH="$PATH"
66+
export PATH="${gnu_coreutils_bin}:${gnu_tar_bin}:$PATH"
67+
68+
# Create symlinks for the certificate extraction function
69+
temp_bin_dir=$(mktemp -d)
70+
ln -s "${brew_prefix}/bin/gtail" "${temp_bin_dir}/tail"
71+
ln -s "${brew_prefix}/bin/gtar" "${temp_bin_dir}/tar"
72+
export PATH="${temp_bin_dir}:$PATH"
73+
6074
macos_use_cert_file_from_linux_cacerts_package
61-
unalias tail tar
75+
76+
# Restore original PATH and cleanup
77+
export PATH="$original_PATH"
78+
rm -rf "$temp_bin_dir"
6279

6380
install_rustup
6481
install_rust_toolchain "$toolchain"
@@ -71,6 +88,9 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
7188
else
7289
echo "--- Setting up Linux environment"
7390

91+
# Accept habitat license
92+
sudo -E hab license accept
93+
7494
# TODO: these should be in a shared script?
7595
sudo -E hab pkg install core/zeromq
7696
sudo -E hab pkg install core/protobuf

.expeditor/scripts/verify/shared.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ source .expeditor/scripts/shared.sh
66

77
# This script should contain all shared functions for the verify pipeline
88

9-
# Always accept habitat license
10-
if [[ -z "${HAB_LICENSE:-}" ]]; then
11-
sudo hab license accept
12-
else
13-
echo "Habitat license already accepted via HAB_LICENSE environment variable"
9+
# Set up writable HAB_ROOT_PATH on macOS to avoid read-only filesystem issues
10+
if [[ "$OSTYPE" == darwin* ]]; then
11+
export HAB_ROOT_PATH
12+
HAB_ROOT_PATH=$(mktemp -d /tmp/hab-root-XXXXXX)
13+
# Clean up Darwin-specific temp directory on exit
14+
trap 'rm -rf "$HAB_ROOT_PATH"' EXIT
1415
fi
1516

17+
# Always accept habitat license
18+
sudo -E hab license accept
19+
1620
get_rustfmt_toolchain() {
1721
# It turns out that every nightly version of rustfmt has slight tweaks from the previous version.
1822
# This means that if we're always using the latest version, then we're going to have enormous

.expeditor/verify.pipeline.yml

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ expeditor:
77
buildkite:
88
timeout_in_minutes: 60
99
env:
10+
HAB_LICENSE: "accept-no-persist"
1011
HAB_BLDR_CHANNEL: "base-2025"
1112
HAB_STUDIO_SECRET_HAB_REFRESH_CHANNEL: "base-2025"
1213
HAB_REFRESH_CHANNEL: "base-2025"
@@ -50,10 +51,19 @@ steps:
5051

5152
- label: "[lint] :linux: :paperclip: clippy!"
5253
command: make lint
53-
expeditor:
54-
executor:
55-
docker:
56-
privileged: true
54+
agents:
55+
queue: 'default-privileged'
56+
plugins:
57+
docker#v3.3.0:
58+
always-pull: true
59+
user: "buildkite-agent"
60+
group: "buildkite-agent"
61+
image: "chefes/buildkite"
62+
privileged: true
63+
environment:
64+
- HAB_LICENSE
65+
- HAB_AUTH_TOKEN
66+
- HAB_BLDR_CHANNEL
5767
timeout_in_minutes: 10
5868

5969
- label: "[lint] :windows: :paperclip: clippy!"
@@ -586,22 +596,67 @@ steps:
586596
automatic:
587597
limit: 10 # Addressing current Anka system timeouts due to oversubscription
588598

589-
- label: "[unit] :darwin: multiple components"
599+
- label: "[unit] :darwin: common"
590600
env:
591601
HAB_LICENSE: "accept-no-persist"
592602
HOMEBREW_NO_AUTO_UPDATE: 1
593603
command:
594604
- .expeditor/scripts/verify/run_cargo_test.sh common
605+
expeditor:
606+
executor:
607+
macos:
608+
os-version: "12"
609+
inherit-environment-vars: true
610+
timeout_in_minutes: 20
611+
retry:
612+
automatic:
613+
limit: 1
614+
615+
- label: "[unit] :darwin: core"
616+
env:
617+
HAB_LICENSE: "accept-no-persist"
618+
HOMEBREW_NO_AUTO_UPDATE: 1
619+
command:
595620
- .expeditor/scripts/verify/run_cargo_test.sh core
621+
expeditor:
622+
executor:
623+
macos:
624+
os-version: "12"
625+
inherit-environment-vars: true
626+
timeout_in_minutes: 20
627+
soft_fail: true
628+
retry:
629+
automatic:
630+
limit: 1
631+
632+
- label: "[unit] :darwin: hab"
633+
env:
634+
HAB_LICENSE: "accept-no-persist"
635+
HOMEBREW_NO_AUTO_UPDATE: 1
636+
command:
596637
- .expeditor/scripts/verify/run_cargo_test.sh hab
638+
expeditor:
639+
executor:
640+
macos:
641+
os-version: "12"
642+
inherit-environment-vars: true
643+
timeout_in_minutes: 20
644+
retry:
645+
automatic:
646+
limit: 1
647+
648+
- label: "[unit] :darwin: http-client"
649+
env:
650+
HAB_LICENSE: "accept-no-persist"
651+
HOMEBREW_NO_AUTO_UPDATE: 1
652+
command:
597653
- .expeditor/scripts/verify/run_cargo_test.sh http-client
598654
expeditor:
599655
executor:
600656
macos:
601657
os-version: "12"
602658
inherit-environment-vars: true
603-
timeout_in_minutes: 30
604-
soft_fail: true
659+
timeout_in_minutes: 20
605660
retry:
606661
automatic:
607662
limit: 1

0 commit comments

Comments
 (0)