Skip to content

Commit 9d18f4f

Browse files
committed
Merge remote-tracking branch 'couchbase/trinity' into phoenix
This merge was non-trivial, and required a few minor fixes to ensure that tests pass: - Re-addition of config_profile:unload_profile_for_test() in failover_test_teardown/2, as it needed moving from manual_failover_test_teardown/2, but didn't exist in trinity - Fixing new include of cut.hrl to use new path in phoenix - Removal of no longer needed X_teardown functions, replacing with failover_test_teardown, which was performed in original change to master, but couldn't be included in the backport as the tests didn't exist in trinity - Addition of mock for ns_node_disco_events in graceful_failover_test_setup, needed now that fake_ns_pubsub isn't being used. Note, this change was made originally in master when fake_ns_pubsub was removed, but the graceful_failover tests don't exist in trinity, so that part of the change couldn't be backported to trinity. As such, the change made here is as close to the master version, to ease future merge-forwards. - Moving mock for cb_atomic_persistent_term from failover_tests to mock_helpers, as this change was originally made when adding mock_helpers, but lost in the backport to trinity as this function doesn't exist in trinity - Rename fake_chronicle_kv:new -> setup and unload -> teardown for usages not in trinity * couchbase/trinity: MB-67857: Notify on fake_chronicle_kv key updates MB-67857: Simplify fake_chronicle_kv:update_snapshot/2 MB-67857: Use ?FUNCTION_NAME in mock_helpers MB-67857: Fix ns_rebalance_report_manager name in mock_helpers MB-67857[BP]: Support concurrent writers in fake_chronicle_kv MB-67857[BP]: Put fake_chronicle_kv seqno in snapshot MB-67857[BP]: Remove ns_pubsub mock MB-67857[BP]: Rename fake_chronicle_kv:new/unload to setup/teardown MB-67857[BP]: Refactor to avoid fake_ns_pubsub uses MB-67857[BP]: Pull failover test mocks into new module MB-67857[BP]: Simplify meck unloading MB-67857[BP]: Fix fake_chronicle_kv MB-66812: Add metakv API test Change-Id: I12c632d6bd07485970928e673a1d91d56ca8ec08
2 parents 6a8b2df + 5a13ab5 commit 9d18f4f

File tree

14 files changed

+653
-256
lines changed

14 files changed

+653
-256
lines changed

apps/ns_server/src/chronicle_metakv.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,10 @@ sync_quorum(Timeout) ->
416416
-ifdef(TEST).
417417

418418
setup() ->
419-
fake_chronicle_kv:new().
419+
fake_chronicle_kv:setup().
420420

421421
teardown(_) ->
422-
fake_chronicle_kv:unload().
422+
fake_chronicle_kv:teardown().
423423

424424
get_dir_content(Dir) ->
425425
get_dir_content(Dir, true).

apps/ns_server/src/jwt_issuer.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ basic_test() ->
9898

9999
meck:new(chronicle_compat_events, [passthrough]),
100100
meck:expect(chronicle_compat_events, subscribe, fun(_) -> ok end),
101-
fake_chronicle_kv:new(),
101+
fake_chronicle_kv:setup(),
102102
fake_chronicle_kv:update_snapshot(?JWT_SIGNING_KEYS_KEY, generate_keys()),
103103
fake_chronicle_kv:update_snapshot(ns_bucket:root(), []),
104104

@@ -120,7 +120,7 @@ basic_test() ->
120120
password_expired = false}, _}, RV1),
121121

122122
gen_server:stop(CachePid),
123-
fake_chronicle_kv:unload(),
123+
fake_chronicle_kv:teardown(),
124124
fake_ns_config:teardown(),
125125
meck:unload(chronicle_compat_events).
126126

apps/ns_server/src/menelaus_web_crud.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,10 @@ setup() ->
510510
fun (_, Body, _) ->
511511
ejson:encode(Body)
512512
end),
513-
fake_chronicle_kv:new().
513+
fake_chronicle_kv:setup().
514514

515515
teardown(_) ->
516-
fake_chronicle_kv:unload(),
516+
fake_chronicle_kv:teardown(),
517517
meck:unload(menelaus_util),
518518
meck:unload(cb_util),
519519
meck:unload(rpc).

apps/ns_server/src/ns_bucket.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3653,7 +3653,7 @@ get_max_buckets_test_() ->
36533653
<- Tests]}.
36543654

36553655
uuid2bucket_key_test() ->
3656-
fake_chronicle_kv:new(),
3656+
fake_chronicle_kv:setup(),
36573657
meck:new(cluster_compat_mode, [passthrough]),
36583658
try
36593659
Root = root(),
@@ -3797,7 +3797,7 @@ uuid2bucket_key_test() ->
37973797
Snapshot2))
37983798
after
37993799
meck:unload(cluster_compat_mode),
3800-
fake_chronicle_kv:unload()
3800+
fake_chronicle_kv:teardown()
38013801
end.
38023802

38033803
-endif.

apps/ns_server/test/dcp_tests.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dcp_test_setup(#{nodes := Nodes,
3232
buckets := Buckets,
3333
connections := Conns} = _SetupCfg) ->
3434
fake_ns_config:setup(),
35-
fake_chronicle_kv:new(),
35+
fake_chronicle_kv:setup(),
3636

3737
set_conn_count_for_buckets(Buckets, Conns),
3838

@@ -90,7 +90,7 @@ dcp_test_teardown(_SetupCfg, PidMap) ->
9090

9191
meck:unload(ns_memcached),
9292

93-
fake_chronicle_kv:unload(),
93+
fake_chronicle_kv:teardown(),
9494
fake_ns_config:teardown().
9595

9696
set_replication_for_buckets(Buckets, Replications) ->

0 commit comments

Comments
 (0)