Skip to content

Commit

Permalink
CLIENT-3201 Skip MRT tests if namespace is not configured as strong c…
Browse files Browse the repository at this point in the history
…onsistency.
  • Loading branch information
BrianNichols committed Dec 5, 2024
1 parent b733f24 commit 07ff667
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
41 changes: 28 additions & 13 deletions src/test/aerospike_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,21 @@
#include <aerospike/aerospike_info.h>
#include <aerospike/as_event.h>
#include <aerospike/as_metrics.h>
#include <aerospike/as_shm_cluster.h>

#include "test.h"
#include "aerospike_test.h"

/******************************************************************************
* MACROS
*****************************************************************************/
//---------------------------------
// Macros
//---------------------------------

#define TIMEOUT 1000
#define SCRIPT_LEN_MAX 1048576

/******************************************************************************
* VARIABLES
*****************************************************************************/
//---------------------------------
// Global Variables
//---------------------------------

aerospike * as = NULL;
int g_argc = 0;
Expand All @@ -51,10 +52,11 @@ as_config_tls g_tls = {0};
as_auth_mode g_auth_mode = AS_AUTH_INTERNAL;
bool g_enterprise_server = false;
bool g_has_ttl = false;
bool g_has_sc = false;

/******************************************************************************
* STATIC FUNCTIONS
*****************************************************************************/
//---------------------------------
// Static Functions
//---------------------------------

static bool
as_client_log_callback(as_log_level level, const char * func, const char * file, uint32_t line, const char * fmt, ...)
Expand Down Expand Up @@ -382,6 +384,20 @@ static bool before(atf_plan* plan)
}
cf_free(result);

// Determine if namespace is configured as strong consistency.
as_cluster* cluster = as->cluster;
const char* ns = "test";

if (cluster->shm_info) {
as_cluster_shm* cluster_shm = cluster->shm_info->cluster_shm;
as_partition_table_shm* table = as_shm_find_partition_table(cluster_shm, ns);
g_has_sc = table ? table->sc_mode : false;
}
else {
as_partition_table* table = as_partition_tables_get(&cluster->partition_tables, ns);
g_has_sc = table ? table->sc_mode : false;
}

/*
// Test metrics
as_metrics_policy policy;
Expand Down Expand Up @@ -423,9 +439,9 @@ static bool after(atf_plan* plan)
}
}

/******************************************************************************
* TEST PLAN
*****************************************************************************/
//---------------------------------
// Test Plan
//---------------------------------

PLAN(aerospike_test)
{
Expand Down Expand Up @@ -473,4 +489,3 @@ PLAN(aerospike_test)
plan_add(transaction_async);
#endif
}

6 changes: 6 additions & 0 deletions src/test/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
//---------------------------------

extern aerospike* as;
extern bool g_has_sc;

//---------------------------------
// Macros
Expand Down Expand Up @@ -895,6 +896,11 @@ TEST(txn_batch_abort, "transaction batch abort")

SUITE(transaction, "Transaction tests")
{
// Multi-record transactions require strong consistency namespaces.
if (!g_has_sc) {
return;
}

suite_before(before);
suite_after(after);

Expand Down
6 changes: 6 additions & 0 deletions src/test/transaction_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
//---------------------------------

extern aerospike* as;
extern bool g_has_sc;
static as_monitor monitor;

//---------------------------------
Expand Down Expand Up @@ -1129,6 +1130,11 @@ TEST(txn_async_batch_abort, "transaction async batch abort")

SUITE(transaction_async, "Async transaction tests")
{
// Multi-record transactions require strong consistency namespaces.
if (!g_has_sc) {
return;
}

suite_before(before);
suite_after(after);

Expand Down

0 comments on commit 07ff667

Please sign in to comment.