From 75d2854d6c35f9f92a81837e767456531c7ec6e7 Mon Sep 17 00:00:00 2001 From: firest Date: Sat, 18 Nov 2023 09:41:25 +0800 Subject: [PATCH] ci test --- .devcontainer/docker-compose.yaml | 4 ++-- .github/workflows/ci.yml | 3 ++- src/erlfdb_util.erl | 11 ++++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml index dceb276..2c6b331 100644 --- a/.devcontainer/docker-compose.yaml +++ b/.devcontainer/docker-compose.yaml @@ -7,7 +7,7 @@ services: ERLANG_VERSION: "24" # This should always match the value in fdb.image - FDB_VERSION: "6.3.23" + FDB_VERSION: "7.1.43" environment: # This needs to match the name of the FoundationDB service below @@ -28,4 +28,4 @@ services: network_mode: service:fdb fdb: - image: foundationdb/foundationdb:6.3.23 + image: foundationdb/foundationdb:7.1.43 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f93f904..119f376 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: strategy: matrix: #test-name: [api, directory, directory_hca, tuple] - test-name: [api] + test-name: [api, directory] api-version: [710] container: image: ghcr.io/emqx/couchdb-erlfdb:erlang-25-fdb-7.1.43 @@ -129,6 +129,7 @@ jobs: TEST_NAME: ${{ matrix.test-name }} API_VERSION: ${{ matrix.api-version }} COVER_ENABLED: true + REBAR_PROFILE: devcontainer ERL_LIBS: _build/devcontainer+test/lib/erlfdb/ run: | mkdir -p /usr/src/erlfdb/test/ diff --git a/src/erlfdb_util.erl b/src/erlfdb_util.erl index f60e857..5482174 100644 --- a/src/erlfdb_util.erl +++ b/src/erlfdb_util.erl @@ -46,12 +46,16 @@ get_test_db(Options) -> init_test_cluster(Options) -> % Hack to ensure erlfdb app environment is loaded during unit tests ok = application:ensure_started(erlfdb), + ct:print(">>> init_test_cluster,Line:~p~n", [?LINE]), case application:get_env(erlfdb, test_cluster_file) of {ok, system_default} -> + ct:print(">>> init_test_cluster,Line:~p~n", [?LINE]), {ok, <<>>}; {ok, ClusterFile} -> + ct:print(">>> init_test_cluster,Line:~p~n", [?LINE]), {ok, ClusterFile}; undefined -> + ct:print(">>> init_test_cluster,Line:~p~n", [?LINE]), init_test_cluster_int(Options) end. @@ -96,20 +100,25 @@ debug_cluster(Tx, Start, End) -> ). init_test_cluster_int(Options) -> + ct:print(">>> init_test_cluster,Line:~p~n", [?LINE]), {ok, CWD} = file:get_cwd(), DefaultIpAddr = {127, 0, 0, 1}, DefaultPort = get_available_port(), DefaultDir = filename:join(CWD, ".erlfdb"), + ct:print(">>> init_test_cluster,Line:~p~n", [?LINE]), + IpAddr = ?MODULE:get(Options, ip_addr, DefaultIpAddr), Port = ?MODULE:get(Options, port, DefaultPort), Dir = ?MODULE:get(Options, dir, DefaultDir), ClusterName = ?MODULE:get(Options, cluster_name, <<"erlfdbtest">>), ClusterId = ?MODULE:get(Options, cluster_id, <<"erlfdbtest">>), - DefaultClusterFile = <<"/etc/foundationdb/fdb.cluster">>, + DefaultClusterFile = filename:join(Dir, <<"erlfdb.cluster">>), ClusterFile = ?MODULE:get(Options, cluster_file, DefaultClusterFile), + ct:print(">>> init_test_cluster,Line:~p~n", [?LINE]), + write_cluster_file(ClusterFile, ClusterName, ClusterId, IpAddr, Port), FDBServerBin = find_fdbserver_bin(Options),