Skip to content

Commit

Permalink
ci test
Browse files Browse the repository at this point in the history
  • Loading branch information
lafirest committed Nov 18, 2023
1 parent 98271d8 commit a8d915c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,4 +28,4 @@ services:
network_mode: service:fdb

fdb:
image: foundationdb/foundationdb:6.3.23
image: foundationdb/foundationdb:7.1.43
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,19 @@ 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
services:
foundationdb:
image: foundationdb/foundationdb:7.1.43
env:
REBAR_PROFILE: devcontainer
# Set to 1 for verbose rebar3 logging
DEBUG: 0
# Set to 1 for even more verbose rebar3 logging
DIAGNOSTIC: 0
steps:
- name: Check out repository code
uses: actions/checkout@v4
Expand Down
11 changes: 10 additions & 1 deletion src/erlfdb_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit a8d915c

Please sign in to comment.