Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCORE-1928 Use baasaas for baas integration tests in CI #7423

Merged
merged 33 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
42b5cfa
Start a baasaas instance to run baas integration tests against
jbreams Jan 4, 2024
64737cb
Make redirect tests work against random baas urls
jbreams Jan 10, 2024
5267fb2
Merge remote-tracking branch 'origin/master' into jbr/baasaas
jbreams Jan 22, 2024
74cec93
fix merge
jbreams Jan 22, 2024
e41a531
log baas coid for admin api requests
jbreams Jan 24, 2024
c28d816
fix schema migration tests
jbreams Jan 25, 2024
a5381d7
allow starting with a patchid
jbreams Jan 26, 2024
b8b2c24
fix merge
jbreams Jan 26, 2024
56c7e43
Merge remote-tracking branch 'origin/master' into jbr/baasaas
jbreams Jan 27, 2024
845d7b2
Merge remote-tracking branch 'origin/master' into jbr/baasaas
jbreams Feb 12, 2024
af8424b
make dependencies.list YAML
jbreams Feb 14, 2024
a6af90f
Merge remote-tracking branch 'origin/master' into jbr/baasaas
jbreams Feb 14, 2024
65fa191
Merge remote-tracking branch 'origin/master' into jbr/baasaas
jbreams Feb 14, 2024
4a65835
remove some debugging lines
jbreams Feb 14, 2024
2c048cd
debugging rhel7 crash
jbreams Feb 21, 2024
abd1c15
temporarily download ca certs package
jbreams Feb 22, 2024
2c97874
Merge remote-tracking branch 'origin/master' into jbr/baasaas
jbreams Feb 22, 2024
c8b3b1f
fix some test failures that were my fault
jbreams Feb 23, 2024
970e236
Merge remote-tracking branch 'origin/master' into jbr/baasaas
jbreams Feb 23, 2024
b63cbde
Merge remote-tracking branch 'origin/master' into jbr/baasaas
jbreams Feb 26, 2024
7378d98
Merge remote-tracking branch 'origin/master' into jbr/baasaas
jbreams Feb 28, 2024
a54815e
Merge remote-tracking branch 'origin/master' into jbr/baasaas
jbreams Mar 6, 2024
95de793
update baas
jbreams Mar 6, 2024
4f4f406
Merge remote-tracking branch 'origin/master' into jbr/baasaas
jbreams Mar 6, 2024
208f565
fix bad merge
jbreams Mar 6, 2024
2e96fc3
lint
jbreams Mar 6, 2024
faae632
use correct path for ca bundle
jbreams Mar 6, 2024
2dfe1db
fixes from PR
jbreams Mar 12, 2024
1ece73b
Merge remote-tracking branch 'origin/master' into jbr/baasaas
jbreams Mar 12, 2024
0785694
changelog and bump baas version
jbreams Mar 12, 2024
7f55bcf
update docs and force create an app that lives forever
jbreams Mar 12, 2024
a0d375b
update docs
jbreams Mar 12, 2024
f7aeff0
typo
jbreams Mar 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 15 additions & 4 deletions evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ functions:
if [ -z "${disable_tests_against_baas|}" ]; then
scheme="http"
set_cmake_var baas_vars REALM_ENABLE_AUTH_TESTS BOOL On
set_cmake_var baas_vars REALM_MONGODB_ENDPOINT STRING "$scheme://localhost:9090"
if [ -n "${baas_admin_port|}" ]; then
set_cmake_var baas_vars REALM_ADMIN_ENDPOINT STRING "$scheme://localhost:${baas_admin_port}"
fi
Expand Down Expand Up @@ -156,7 +155,7 @@ functions:
if [ -n "${curl_base|}" ]; then
set_cmake_var curl_vars CURL_LIBRARY PATH "$(./evergreen/abspath.sh ${curl_base}/lib/libcurl.dll.a)"
set_cmake_var curl_vars CURL_INCLUDE_DIR PATH "$(./evergreen/abspath.sh ${curl_base}/include)"
set_cmake_var baas_vars REALM_CURL_CACERTS PATH "$(./evergreen/abspath.sh "${curl_base}/bin/cacert.pem")"
set_cmake_var baas_vars REALM_CURL_CACERTS PATH "$(./evergreen/abspath.sh "${curl_base}/bin/curl-ca-bundle.crt")"
fi

set_cmake_var realm_vars REALM_NO_TESTS BOOL ${no_tests|Off}
Expand Down Expand Up @@ -208,10 +207,17 @@ functions:
file: './realm-core/benchmark_results/results.latest.json'

"run tests":
- command: expansions.update
params:
file: realm-core/dependencies.yml
- command: shell.exec
params:
working_dir: realm-core
shell: bash
env:
BAASAAS_API_KEY: "${baasaas_api_key}"
BAASAAS_REF_SPEC: "${BAAS_VERSION}"
BAASAAS_START_MODE: "githash"
script: |-
set -o errexit
set -o verbose
Expand Down Expand Up @@ -244,6 +250,12 @@ functions:

TEST_FLAGS="--no-tests=error $TEST_FLAGS ${test_flags|}"

if [[ -n "${disable_tests_against_baas|}" ]]; then
unset BAASAAS_API_KEY
unset BAASAAS_REF_SPEC
unset BAASAAS_START_MODE
fi

if [[ -n "${llvm_symbolizer}" ]]; then
export ASAN_SYMBOLIZER_PATH="$(./evergreen/abspath.sh ${llvm_symbolizer})"
fi
Expand Down Expand Up @@ -977,18 +989,17 @@ tasks:
test_label: objstore-local
test_executable_name: "realm-object-store-tests"
verbose_test_output: true
disable_tests_against_baas: true
- func: "check branch state"

# These are baas object store tests that run against baas running on a remote host
- name: baas-integration-tests
tags: [ "test_suite", "for_pull_requests", "requires_baas" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit confusing to have both the disable_tests_against_baas var and requires_baas. Can we have only one of these for clarity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately no, requires_baas is a tag rather than an expansion which tells evergreen which tasks to run and disable_tests_against_baas is an expansion used in commands to tell them how to compile the object-store tests.

exec_timeout_secs: 3600
commands:
- func: "launch remote baas"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to eventually get rid of some of the launch/wait shell scripts, but I guess we'd have to wait to port over the network tests to this as well. Is there a viable path to doing this with baasaas?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was gonna do that in a separate PR.

- func: "compile"
vars:
target_to_build: ObjectStoreTests
- func: "wait for remote baas to start"
- func: "run tests"
vars:
test_label: objstore-baas
Expand Down
19 changes: 13 additions & 6 deletions test/object-store/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ endif()
target_link_libraries(ObjectStoreTestLib Catch2::Catch2 ObjectStore RealmFFIStatic TestUtil)
enable_stdfilesystem(ObjectStoreTestLib)

if(REALM_CURL_CACERTS)
target_compile_definitions(ObjectStoreTestLib PRIVATE
REALM_CURL_CACERTS="${REALM_CURL_CACERTS}"
)
endif()

add_executable(ObjectStoreTests main.cpp ${RESOURCES})
set_target_properties(ObjectStoreTests PROPERTIES OUTPUT_NAME realm-object-store-tests)
target_link_libraries(ObjectStoreTests ObjectStoreTestLib TestUtil)
Expand Down Expand Up @@ -131,16 +137,17 @@ if(REALM_ENABLE_SYNC)
target_link_libraries(ObjectStoreTestLib SyncServer)
option(REALM_ENABLE_AUTH_TESTS "" OFF)
if(REALM_ENABLE_AUTH_TESTS)
if(NOT REALM_MONGODB_ENDPOINT)
message(FATAL_ERROR "REALM_MONGODB_ENDPOINT must be set when specifying REALM_ENABLE_AUTH_TESTS.")
endif()

message(STATUS "Auth tests enabled: ${REALM_MONGODB_ENDPOINT}")
target_compile_definitions(ObjectStoreTestLib PRIVATE
REALM_ENABLE_AUTH_TESTS=1
REALM_MONGODB_ENDPOINT="${REALM_MONGODB_ENDPOINT}"
)

if(REALM_MONGODB_ENDPOINT)
message(STATUS "Auth tests enabled: ${REALM_MONGODB_ENDPOINT}")
target_compile_definitions(ObjectStoreTestLib PRIVATE
REALM_MONGODB_ENDPOINT="${REALM_MONGODB_ENDPOINT}"
)
endif()

if(REALM_ADMIN_ENDPOINT)
message(STATUS "BAAS admin endpoint: ${REALM_ADMIN_ENDPOINT}")
target_compile_definitions(ObjectStoreTests PRIVATE
Expand Down
1 change: 0 additions & 1 deletion test/object-store/sync/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3924,7 +3924,6 @@ TEST_CASE("app: base_url", "[sync][app][base_url]") {
std::unique_ptr<realm::AppSession> app_session;
auto redir_transport = std::make_shared<BaseUrlTransport>();
AutoVerifiedEmailCredentials creds;
util::LogCategory::realm.set_default_level_threshold(realm::util::Logger::Level::TEST_LOGGING_LEVEL);
auto logger = util::Logger::get_default_logger();

App::Config app_config = {"fake-app-id"};
Expand Down
73 changes: 73 additions & 0 deletions test/object-store/test_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <util/test_path.hpp>

#include <realm/util/features.h>
#include <realm/util/logger.hpp>
#include <realm/util/to_string.hpp>

#if TEST_SCHEDULER_UV
Expand All @@ -38,6 +39,76 @@
#include <iostream>
#include <limits.h>

#ifndef TEST_ENABLE_LOGGING
#define TEST_ENABLE_LOGGING 0 // change to 1 to enable trace-level logging
#endif

#ifndef TEST_LOGGING_LEVEL
#if TEST_ENABLE_LOGGING
#define TEST_LOGGING_LEVEL all
#else
#define TEST_LOGGING_LEVEL off
#endif // TEST_ENABLE_LOGGING
#endif // TEST_LOGGING_LEVEL

#define TEST_LOGGING_LEVEL_STORAGE off
#define TEST_LOGGING_LEVEL_SERVER off
/*
#define TEST_LOGGING_LEVEL_SYNC off
#define TEST_LOGGING_LEVEL_RESET trace
#define TEST_LOGGING_LEVEL_APP off
*/

static std::vector<std::pair<std::string_view, realm::util::Logger::Level>> default_log_levels = {
{"Realm", realm::util::Logger::Level::TEST_LOGGING_LEVEL},
#ifdef TEST_LOGGING_LEVEL_STORAGE
{"Realm.Storage", realm::util::Logger::Level::TEST_LOGGING_LEVEL_STORAGE},
#endif
#ifdef TEST_LOGGING_LEVEL_TRANSACTION
{"Realm.Storage.Transaction", realm::util::Logger::Level::TEST_LOGGING_LEVEL_TRANSACTION},
#endif
#ifdef TEST_LOGGING_LEVEL_QUERY
{"Realm.Storage.Query", realm::util::Logger::Level::TEST_LOGGING_LEVEL_QUERY},
#endif
#ifdef TEST_LOGGING_LEVEL_OBJECT
{"Realm.Storage.Object", realm::util::Logger::Level::TEST_LOGGING_LEVEL_OBJECT},
#endif
#ifdef TEST_LOGGING_LEVEL_NOTIFICATION
{"Realm.Storage.Notification", realm::util::Logger::Level::TEST_LOGGING_LEVEL_NOTIFICATION},
#endif
#ifdef TEST_LOGGING_LEVEL_SYNC
{"Realm.Sync", realm::util::Logger::Level::TEST_LOGGING_LEVEL_SYNC},
#endif
#ifdef TEST_LOGGING_LEVEL_CLIENT
{"Realm.Sync.Client", realm::util::Logger::Level::TEST_LOGGING_LEVEL_CLIENT},
#endif
#ifdef TEST_LOGGING_LEVEL_SESSION
{"Realm.Sync.Client.Session", realm::util::Logger::Level::TEST_LOGGING_LEVEL_SESSION},
#endif
#ifdef TEST_LOGGING_LEVEL_CHANGESET
{"Realm.Sync.Client.Changeset", realm::util::Logger::Level::TEST_LOGGING_LEVEL_CHANGESET},
#endif
#ifdef TEST_LOGGING_LEVEL_NETWORK
{"Realm.Sync.Client.Network", realm::util::Logger::Level::TEST_LOGGING_LEVEL_NETWORK},
#endif
#ifdef TEST_LOGGING_LEVEL_RESET
{"Realm.Sync.Client.Reset", realm::util::Logger::Level::TEST_LOGGING_LEVEL_RESET},
#endif
#ifdef TEST_LOGGING_LEVEL_SERVER
{"Realm.Sync.Server", realm::util::Logger::Level::TEST_LOGGING_LEVEL_SERVER},
#endif
#ifdef TEST_LOGGING_LEVEL_APP
{"Realm.App", realm::util::Logger::Level::TEST_LOGGING_LEVEL_APP},
#endif
};

static void set_default_level_thresholds()
{
for (auto [cat, level] : default_log_levels) {
realm::util::LogCategory::get_category(cat).set_default_level_threshold(level);
}
}


int run_object_store_tests(int argc, const char** argv);

Expand Down Expand Up @@ -91,6 +162,8 @@ int run_object_store_tests(int argc, const char** argv)
});
#endif

set_default_level_thresholds();

Catch::Session session;
session.useConfigData(config);
int result = session.run(argc, argv);
Expand Down