Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
eb403ff
refactor: core server files refactored to support re-use in the mock …
JoshuaSBrown Feb 19, 2026
0eb3bf1
refactor: changed mock core server to work with proto3 and reusue abs…
JoshuaSBrown Feb 19, 2026
354bd19
fix: prevent defaults being set to undefined, and interpret numbers a…
JoshuaSBrown Feb 23, 2026
eba87f5
fix: version numbers from proto3 messages follow camel case. (#1868)
JoshuaSBrown Feb 23, 2026
af9c558
Merge branch 'devel' into 1854-DAPS-refactor-mock-core-server-proto3
JoshuaSBrown Feb 23, 2026
83482a5
docs: fix jsdoc error.
JoshuaSBrown Feb 23, 2026
fb65850
[DAPS-1862] - fix allocation change failure (#1864)
JoshuaSBrown Feb 24, 2026
874878c
Merge pull request #1879 from ORNL/staging
JoshuaSBrown Feb 25, 2026
edf9513
[DAPS-1854] - refactor mock core server to use proto3
JoshuaSBrown Mar 12, 2026
5afd3b6
[DAPS-1663] Adding LogContext to dbGetRaw, Correlation_ID to dbMainte…
megatnt1122 Mar 19, 2026
704536c
fix: mock_core server build (#1890)
JoshuaSBrown Mar 19, 2026
d8b0a38
[DAPS-1887] - refactor: facility fuse, remove dead code. (#1888)
JoshuaSBrown Mar 19, 2026
cda8509
[DAPS-1857] - feature: python client, tests, support schema functions…
JoshuaSBrown Mar 19, 2026
b995424
[DAPS-1855] - feature, core, add schema factory to decouple schema lo…
JoshuaSBrown Mar 19, 2026
7ccc58e
[DAPS-1896] - feature: foxx, schema format and type added to schema c…
JoshuaSBrown Mar 23, 2026
5d42565
[DAPS-1893] - feature: common, proto3 add fields for schema type, for…
JoshuaSBrown Mar 23, 2026
1dae067
[DAPS-1830-1] - core foxx refactored json schema integration 1 (#1892)
JoshuaSBrown Mar 24, 2026
c615fc7
[DAPS-1857-2] python client schema support (#1895)
JoshuaSBrown Mar 24, 2026
73ceb46
[DAPS-1830-2] - core foxx refactored json schema integration (#1899)
JoshuaSBrown Mar 24, 2026
d1c2505
[DAPS-1902] - core, common, feat: get schema api client into complian…
JoshuaSBrown Mar 25, 2026
0beb9a3
[DAPS-1906-1] - feature: add core unit testing to CI (#1907)
JoshuaSBrown Mar 25, 2026
635290e
[DAPS-1830-3] - core foxx refactored json schema integration 3 1827 (…
JoshuaSBrown Mar 25, 2026
0fb4652
[DAPS-1910] - upgrade: playwright 1.51.1 version. (#1911)
JoshuaSBrown Mar 26, 2026
3e602cc
[DAPS-1914] - bug, web schema id name version mismatch (#1915)
JoshuaSBrown Mar 27, 2026
73309fc
[DAPS-1913] - refactor: foxx ci test scripts consolidate database nam…
JoshuaSBrown Mar 27, 2026
ce563a8
[DAPS-1916] - tests add integration test for schema client handler to…
JoshuaSBrown Mar 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitlab/build/force_build_core_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ build-core:
GIT_STRATEGY: clone
DOCKER_FILE_PATH: "core/docker/Dockerfile"
DATAFED_HARBOR_REGISTRY: "$REGISTRY" # needed by c_harbor_artifact_count
BUILD_INTERMEDIATE: "FALSE"
BUILD_INTERMEDIATE: "TRUE"
INTERMEDIATE_TARGET: "core-build" # Name of the layer in the dockerfile
INTERMEDIATE_LAYER_NAME: "build"
tags:
- ci-datafed-core
- docker
4 changes: 3 additions & 1 deletion .gitlab/build/retag_core_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ retag-image:
COMPONENT: "core"
GIT_STRATEGY: clone
DATAFED_HARBOR_REGISTRY: "$REGISTRY" # needed by c_harbor_artifact_count
BUILD_INTERMEDIATE: "FALSE"
BUILD_INTERMEDIATE: "TRUE"
INTERMEDIATE_TARGET: "core-build" # Name of the layer in the dockerfile
INTERMEDIATE_LAYER_NAME: "build"
tags:
- docker
5 changes: 5 additions & 0 deletions .gitlab/end_to_end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ end-to-end-foxx-setup:
- echo "-e DATAFED_DATABASE_IP_ADDRESS_PORT=\"$CI_DATAFED_DATABASE_IP_ADDRESS_PORT\" \\" >> "${RUN_FILE}"
- echo "-e DATAFED_DATABASE_HOST=\"$CI_DATAFED_DATABASE_HOST\" \\" >> "${RUN_FILE}"
- echo "-e DATAFED_DEFAULT_LOG_PATH=\"$CONTAINER_LOG_FILE_PATH\" \\" >> "${RUN_FILE}"
- echo "-e ALLOW_PRODUCTION_DB=\"True\" \\" >> "${RUN_FILE}"
- echo "-e DATAFED_DATABASE_NAME=\"sdms\" \\" >> "${RUN_FILE}"
- echo "-e DATAFED_ALLOW_TESTING_PROD_DATABASE=\"True\" \\" >> "${RUN_FILE}"
- echo "-v \"${HOST_LOG_FILE_PATH}:${CONTAINER_LOG_FILE_PATH}\" \\" >> "${RUN_FILE}"
- echo "-v \"./foxx_tmp:/tmp\" \\" >> "${RUN_FILE}"
- echo "-t \"${REGISTRY}/${PROJECT}/${COMPONENT}-${BRANCH_LOWER}:${CI_COMMIT_SHA}\"" >> "${RUN_FILE}"
Expand Down Expand Up @@ -379,6 +382,8 @@ end_to_end_client-test:
DATAFED_DOMAIN: "${CI_DATAFED_DOMAIN}"
DATAFED_PYTHON_CLIENT_ALLOW_SELF_SIGNED_CERTS: "TRUE"
DATAFED_PYTHON_DEPENDENCIES_DIR: "${DATAFED_DEPENDENCIES_INSTALL_PATH}/python"
DATAFED_DATABASE_NAME: "sdms"
ALLOW_PRODUCTION_DB: "true"
stage: end-to-end-test
dependencies:
- end-to-end-gcs-authz-setup
Expand Down
3 changes: 2 additions & 1 deletion .gitlab/stage_image_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ check-core-image:
variables:
PROJECT: "datafed"
COMPONENT: "core"
BUILD_INTERMEDIATE: "FALSE"
BUILD_INTERMEDIATE: "TRUE"
INTERMEDIATE_LAYER_NAME: "build"
WATCHED_PATHS: "docker scripts core common CMakeLists.txt cmake .gitlab-ci.yml"

check-repo-image:
Expand Down
28 changes: 28 additions & 0 deletions .gitlab/stage_unit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
include:
- local: .gitlab/stage_build.yml
- local: .gitlab/common.yml

run-ws-unit-job:
# Either the web container needs to be rebuilt or the container needs to be
Expand Down Expand Up @@ -126,3 +127,30 @@ run-authz-unit-job:
- echo "-c 'cd /datafed/source; /opt/datafed/dependencies/bin/cmake --build build --target test'" >> run_globus.sh
- chmod +x run_globus.sh
- ./run_globus.sh

run-core-unit-job:
needs: ["run-core-build-job"]
stage: unit
variables:
PROJECT: "datafed"
COMPONENT: "core"
GIT_STRATEGY: clone
INTERMEDIATE_LAYER_NAME: "build"
tags:
- ci-datafed-core
- docker
script:
- BRANCH_LOWER=$(echo "$CI_COMMIT_REF_NAME" | tr '[:upper:]' '[:lower:]')
- echo "${HARBOR_DATAFED_GITLAB_CI_REGISTRY_TOKEN}" | docker login "${REGISTRY}" -u "${HARBOR_USER}" --password-stdin
- ./scripts/container_stop.sh -n "core-unit-" -p
- random_string=$(bash -c "cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1")
- |
docker run --rm \
--name "core-unit-${BRANCH_LOWER}-${CI_COMMIT_SHORT_SHA}-${random_string}" \
--entrypoint bash \
-t "${REGISTRY}/${PROJECT}/${COMPONENT}-${INTERMEDIATE_LAYER_NAME}-${BRANCH_LOWER}:${CI_COMMIT_SHA}" \
-c 'cd /datafed/source && \
/opt/datafed/dependencies/bin/ctest \
--test-dir build \
-LE "integration|fixture" \
--output-on-failure'
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ OPTION(ENABLE_END_TO_END_API_TESTS "Enable end-to-end API testing" FALSE)
OPTION(ENABLE_END_TO_END_WEB_TESTS "Enable end-to-end web testing with Playwright" FALSE)
OPTION(ENABLE_FOXX_TESTS "Enable Foxx testing, off by default because it
will overwrite the test database." FALSE)
option(DATAFED_ALLOW_TESTING_PROD_DATABASE
"Allow testing on production database." FALSE)

set(DATAFED_TEST_DATABASE_NAME "sdms_test"
CACHE STRING "Database name used by Foxx tests")
set(INSTALL_REPO_SERVER ${BUILD_REPO_SERVER})
set(INSTALL_AUTHZ ${BUILD_AUTHZ})
set(INSTALL_CORE_SERVER ${BUILD_CORE_SERVER})
Expand Down
9 changes: 4 additions & 5 deletions common/include/common/IAuthenticationManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

// Standard imports
#include <string>

namespace SDMS {

struct LogContext;
/**
* Interface class for managing authenticating
*
Expand All @@ -26,7 +25,7 @@ class IAuthenticationManager {
* Increments the number of times that the key has been accessed, this is
*useful information when deciding if a key should be purged.
**/
virtual void incrementKeyAccessCounter(const std::string &public_key) = 0;
virtual void incrementKeyAccessCounter(const std::string &public_key, LogContext log_context) = 0;

/**
* Will return true if the public key is known. This is also dependent on the
Expand All @@ -39,7 +38,7 @@ class IAuthenticationManager {
* - SESSION
* - PERSISTENT
**/
virtual bool hasKey(const std::string &pub_key) const = 0;
virtual bool hasKey(const std::string &pub_key, LogContext log_context) const = 0;

/**
* Will get the unique id or throw an error
Expand All @@ -49,7 +48,7 @@ class IAuthenticationManager {
* - SESSION
* - PERSISTENT - user or repo
**/
virtual std::string getUID(const std::string &pub_key) const = 0;
virtual std::string getUID(const std::string &pub_key, LogContext log_context) const = 0;

/**
* Purge keys if needed
Expand Down
2 changes: 1 addition & 1 deletion common/include/common/TraceException.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class TraceException : public std::exception {
return m_context;
}

unsigned long getErrorCode() { return m_error_code; }
unsigned long getErrorCode() const { return m_error_code; }

const char *what() const throw() { return m_context.c_str(); }

Expand Down
1 change: 1 addition & 0 deletions common/proto3/common/auth/metadata_validate_request.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ option cc_enable_arenas = true;
message MetadataValidateRequest {
string metadata = 1;
string sch_id = 2;
string format = 3;
}
2 changes: 2 additions & 0 deletions common/proto3/common/auth/schema_create_request.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ message SchemaCreateRequest {
bool pub = 3;
bool sys = 4;
string def = 5;
string type = 6;
string format = 7;
}
2 changes: 2 additions & 0 deletions common/proto3/common/messages/schema_data.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ message SchemaData {
string def = 10;
repeated SchemaData uses = 11;
repeated SchemaData used_by = 12;
string type = 13;
string format = 14;
}
9 changes: 6 additions & 3 deletions common/source/operators/AuthenticationOperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// Local public includes
#include "common/TraceException.hpp"
#include "common/DynaLog.hpp"

// Standard includes
#include <any>
Expand All @@ -26,16 +27,18 @@ void AuthenticationOperator::execute(IMessage &message) {
EXCEPT(1, "'KEY' attribute not defined.");
}

LogContext log_context;
log_context.correlation_id = std::get<std::string>(message.get(MessageAttribute::CORRELATION_ID));
m_authentication_manager->purge();

std::string key = std::get<std::string>(message.get(MessageAttribute::KEY));

std::string uid = "anon";
if (m_authentication_manager->hasKey(key)) {
m_authentication_manager->incrementKeyAccessCounter(key);
if (m_authentication_manager->hasKey(key, log_context)) {
m_authentication_manager->incrementKeyAccessCounter(key, log_context);

try {
uid = m_authentication_manager->getUID(key);
uid = m_authentication_manager->getUID(key, log_context);
} catch (const std::exception& e) {
// Log the exception to help diagnose authentication issues
std::cerr << "[AuthenticationOperator] Failed to get UID for key: "
Expand Down
7 changes: 4 additions & 3 deletions common/tests/unit/test_OperatorFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "common/MessageFactory.hpp"
#include "common/OperatorFactory.hpp"
#include "common/OperatorTypes.hpp"
#include "common/DynaLog.hpp"

// Third party includes
#include <google/protobuf/stubs/common.h>
Expand Down Expand Up @@ -38,15 +39,15 @@ class DummyAuthManager : public IAuthenticationManager {
/**
* Methods only available via the interface
**/
virtual void incrementKeyAccessCounter(const std::string &pub_key) final {
virtual void incrementKeyAccessCounter(const std::string &pub_key, LogContext log_context) final {
++m_counters.at(pub_key);
}

virtual bool hasKey(const std::string &pub_key) const {
virtual bool hasKey(const std::string &pub_key, LogContext log_context) const {
return m_counters.count(pub_key);
}
// Just assume all keys map to the anon_uid
virtual std::string getUID(const std::string &) const {
virtual std::string getUID(const std::string &, LogContext log_context) const {
return "authenticated_uid";
}

Expand Down
75 changes: 38 additions & 37 deletions core/database/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ configure_file(
@ONLY)

if( ENABLE_FOXX_TESTS )
add_test(NAME foxx_setup COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_setup.sh")
add_test(NAME foxx_setup COMMAND "${PROJECT_SOURCE_DIR}/scripts/install_foxx.sh")
add_test(NAME foxx_teardown COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_teardown.sh")
add_test(NAME foxx_db_fixtures COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_fixture_setup.sh")

Expand Down Expand Up @@ -49,40 +49,41 @@ if( ENABLE_FOXX_TESTS )
add_test(NAME foxx_unit_globus_collection_model COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_foxx.sh" -t "unit_globus_collection_model:")
add_test(NAME foxx_unit_globus_token_model COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_foxx.sh" -t "unit_globus_token_model:")

set_tests_properties(foxx_setup PROPERTIES FIXTURES_SETUP Foxx)
set_tests_properties(foxx_teardown PROPERTIES FIXTURES_CLEANUP Foxx)
set_tests_properties(foxx_db_fixtures PROPERTIES FIXTURES_SETUP FoxxDBFixtures FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_version PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_support PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_authz PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_authz_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_record PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_data_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_repo PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_repo_globus PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_repo_metadata PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_base_repo PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_repositories PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_repo_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_validation_repo PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_path PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_user_router PROPERTIES FIXTURES_REQUIRED "Foxx;FoxxDBFixtures")
set_tests_properties(foxx_coll_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_proj_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_schema_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_acl_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_config_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_topic_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_group_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_admin_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_metrics_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_note_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_version_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_tag_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_query_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_task_router PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_unit_user_token PROPERTIES FIXTURES_REQUIRED Foxx)
set_tests_properties(foxx_unit_user_model PROPERTIES FIXTURES_REQUIRED "Foxx;FoxxDBFixtures")
set_tests_properties(foxx_unit_globus_collection_model PROPERTIES FIXTURES_REQUIRED "Foxx;FoxxDBFixtures")
set_tests_properties(foxx_unit_globus_token_model PROPERTIES FIXTURES_REQUIRED "Foxx;FoxxDBFixtures")
set_tests_properties(foxx_setup PROPERTIES WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/core/database/foxx" FIXTURES_SETUP Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME};ALLOW_PRODUCTION_DB=${DATAFED_ALLOW_TESTING_PROD_DATABASE}")
set_tests_properties(foxx_db_fixtures PROPERTIES FIXTURES_SETUP FoxxDBFixtures FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME};ALLOW_PRODUCTION_DB=${DATAFED_ALLOW_TESTING_PROD_DATABASE}")
set_tests_properties(foxx_teardown PROPERTIES FIXTURES_CLEANUP Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")

set_tests_properties(foxx_version PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_support PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_authz PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_authz_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_record PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_data_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_repo PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_repo_globus PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_repo_metadata PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_base_repo PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_repositories PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_repo_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_validation_repo PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_path PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_user_router PROPERTIES FIXTURES_REQUIRED "Foxx;FoxxDBFixtures" ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_coll_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_proj_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_schema_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_acl_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_config_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_topic_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_group_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_admin_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_metrics_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_note_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_version_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_tag_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_query_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_task_router PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_unit_user_token PROPERTIES FIXTURES_REQUIRED Foxx ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_unit_user_model PROPERTIES FIXTURES_REQUIRED "Foxx;FoxxDBFixtures" ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_unit_globus_collection_model PROPERTIES FIXTURES_REQUIRED "Foxx;FoxxDBFixtures" ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
set_tests_properties(foxx_unit_globus_token_model PROPERTIES FIXTURES_REQUIRED "Foxx;FoxxDBFixtures" ENVIRONMENT "DATAFED_DATABASE_NAME=${DATAFED_TEST_DATABASE_NAME}")
endif()
4 changes: 2 additions & 2 deletions core/database/foxx/api/coll_router.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const router = createRouter();
const joi = require("joi");

const g_db = require("@arangodb").db;
const g_graph = require("@arangodb/general-graph")._graph("sdmsg");
const g_graph = require("./db_config").getGraph();
const g_lib = require("./support");
const error = require("./lib/error_codes");
const permissions = require("./lib/permissions");
Expand Down Expand Up @@ -405,7 +405,7 @@ router
_from: coll_id,
});
if (old_alias) {
const graph = require("@arangodb/general-graph")._graph("sdmsg");
const graph = require("./db_config").getGraph();
graph.a.remove(old_alias._to);
}

Expand Down
2 changes: 1 addition & 1 deletion core/database/foxx/api/data_router.js
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ function recordUpdate(client, record, result) {
_from: data_id,
});
if (old_alias) {
const graph = require("@arangodb/general-graph")._graph("sdmsg");
const graph = require("./db_config").getGraph();
graph.a.remove(old_alias._to);
}

Expand Down
45 changes: 45 additions & 0 deletions core/database/foxx/api/db_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* @module db_config
* @description Shared database configuration for Foxx services.
*
* Derives the graph name from the current database name using the convention
* <dbname>g (e.g. "sdms" -> "sdmsg", "sdms_test" -> "sdms_testg").
*
* Usage in routers:
*
* const { GRAPH_NAME, getGraph } = require('./db_config');
*
* // If you need just the name (e.g. for AQL):
* const aql = require('@arangodb').aql;
* const result = db._query(aql`FOR v IN 1..1 OUTBOUND ${startId} GRAPH ${GRAPH_NAME} ...`);
*
* // If you need the graph object:
* const graph = getGraph();
*/

"use strict";

const db = require("@arangodb").db;
const generalGraph = require("@arangodb/general-graph");

/** Graph name derived from the current database: <dbname>g */
const GRAPH_NAME = db._name() + "g";

/**
* Get the named graph object.
*
* This is a function rather than a module-level constant so that callers
* in request-scoped code get a fresh handle. For module-scope usage
* (e.g. `const g_graph = getGraph()`) the behavior is identical to
* the old `_graph("sdmsg")` pattern.
*
* @returns {object} ArangoDB general-graph instance
*/
function getGraph() {
return generalGraph._graph(GRAPH_NAME);
}

module.exports = {
GRAPH_NAME,
getGraph,
};
Loading
Loading