Skip to content

Commit

Permalink
[ADP-3224] Set LOCAL_CLUSTER_CONFIGS to fix unit tests on windows (#…
Browse files Browse the repository at this point in the history
…4284)

- [x] Add `cluster-configs` to windows testing bundle
- [x] Set `LOCAL_CLUSTER_CONFIGS=test\data\cluster-configs`

### Issue Number

Failing build:
https://github.com/cardano-foundation/cardano-wallet/actions/runs/7044358252/job/19172149072#step:3:7553

Recent passing build from this PR:
https://github.com/cardano-foundation/cardano-wallet/actions/runs/7088589000

ADP-3224
  • Loading branch information
HeinrichApfelmus authored Dec 4, 2023
2 parents ac7576e + c8587dd commit f9c7091
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ on:
branch:
description: 'Run tests against branch'
default: 'master'
status:
description: 'Run tests against status (use `any` as wildcard)'
default: 'passed'
required: true
type: choice
options:
- passed
- any
build:
description: 'Run tests against build number'
required: false
default: 'latest'

jobs:
setup:
Expand All @@ -29,7 +41,9 @@ jobs:
working-directory: ${{ env.WORK_DIR }}
run: |
bundle install
rake get_latest_windows_tests[%BRANCH%,cardano-wallet-tests-win64]
echo "STATUS = ${{ github.event.inputs.status }}"
echo "BUILD = ${{ github.event.inputs.build }}"
rake get_latest_windows_tests[%BRANCH%,cardano-wallet-tests-win64,${{ github.event.inputs.status }},${{ github.event.inputs.build }}]
- name: Report version
working-directory: ${{ env.WORK_DIR }}
Expand All @@ -50,6 +64,8 @@ jobs:
with:
name: cardano-wallet-tests-win64
- run: '.\\cardano-wallet-test-unit.exe --color --jobs 1 --skip /Cardano.Wallet.DB.Sqlite/ +RTS -M2G -N2'
env:
LOCAL_CLUSTER_CONFIGS: test\data\cluster-configs

text-class-test-unit:
name: 'test-class:unit'
Expand Down
5 changes: 3 additions & 2 deletions lib/local-cluster/lib/Cardano/Wallet/Launch/Cluster.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1031,10 +1031,11 @@ clusterEraFromEnv =
_ -> die $ var ++ ": unknown era"
withDefault = fromMaybe maxBound

localClusterConfigsFromEnv :: IO (Tagged "cluster-configs" String)
localClusterConfigsFromEnv :: IO (Tagged "cluster-configs" FilePath)
localClusterConfigsFromEnv = lookupEnvNonEmpty "LOCAL_CLUSTER_CONFIGS"
<&> Tagged @"cluster-configs"
. fromMaybe "../local-cluster/test/data/cluster-configs"
. fromMaybe
(".." </> "local-cluster" </> "test" </> "data" </> "cluster-configs")

clusterEraToString :: ClusterEra -> String
clusterEraToString = \case
Expand Down
1 change: 1 addition & 0 deletions nix/windows-testing-bundle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
let
testData = {
wallet = ../lib/wallet/test/data;
local-cluster = ../lib/local-cluster/test/data;
};

name = "cardano-wallet-${cardano-wallet.version}-tests-win64";
Expand Down
10 changes: 7 additions & 3 deletions test/e2e/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,16 @@ task :display_versions, [:bin_dir] do |_task, args|
end
end

task :get_latest_windows_tests, [:branch, :destination] do |_task, args|
branch = args[:branch] || 'master'
task :get_latest_windows_tests, [:branch, :destination, :status, :build] do |_task, args|
destination = args[:destination] || 'cardano-wallet-tests-win64'
job_key = 'build-windows-tests'
bk = Buildkite.new
last_build = bk.last_build_number(branch: branch, state: 'passed')
status = args[:status]
branch = args[:branch] || 'master'
build = args[:build] || 'latest'
options = status == 'any' ? { branch: branch } : { branch: branch, state: status }
last_build =
build == 'latest' ? bk.last_build_number(options) : build
log "Latest passing buildkite '#{bk.pipeline}' pipeline for branch '#{branch}' is #{last_build}"
jobs = bk.jobs(last_build)
mk_dir(destination)
Expand Down
1 change: 1 addition & 0 deletions test/e2e/helpers/buildkite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def get_artifact_url(build_no, job_id)
end

def get_artifacts(build_no, job_id, target_dir, target_file = 'binary-dist', unzip: true)
log "Downloading artifacts for build #{build_no} job #{job_id} to #{target_dir}"
url = get_artifact_url(build_no, job_id)
wget(url, target_file)
unzip_artifact(target_file, target_dir) if unzip
Expand Down

0 comments on commit f9c7091

Please sign in to comment.