Skip to content

Add SCITOKENS_SKIP_ONLINE_TESTS env var to disable network-dependent tests#207

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/add-test-parameter-disable-online-tests
Draft

Add SCITOKENS_SKIP_ONLINE_TESTS env var to disable network-dependent tests#207
Copilot wants to merge 3 commits intomasterfrom
copilot/add-test-parameter-disable-online-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 7, 2026

Packaging tooling (e.g., Gentoo ebuilds) typically runs in network-sandboxed environments. There was no way to skip tests requiring internet connectivity.

  • Added SCITOKENS_SKIP_ONLINE_TESTS environment variable check using GTEST_SKIP() to all 6 network-dependent tests in test/main.cpp:
    • KeycacheTest.RefreshTest
    • KeycacheTest.RefreshInvalid
    • KeycacheTest.RefreshExpiredTest
    • KeycacheTest.NegativeCacheTest
    • KeycacheTest.LoadJwksMissingTest
    • KeycacheTest.LoadJwksTriggersRefreshWhenStale

Usage

SCITOKENS_SKIP_ONLINE_TESTS=1 ./scitokens-gtest

Produces standard GTest skip output:

[  SKIPPED ] KeycacheTest.RefreshTest
[  SKIPPED ] KeycacheTest.RefreshInvalid
...
[  PASSED  ] 35 tests.
[  SKIPPED ] 6 tests.
Original prompt

This section details on the original issue you should resolve

<issue_title>Add test parameter to disable online tests (for offline testing)</issue_title>
<issue_description>Most packaging tooling runs in offline / network sandboxed environments, so it would be useful for packagers if all tests requiring network connectivity could be disabled in one go e.g. with a commandline argument when running the tests, or an environment variable.

This currently affects the following tests (as of release 1.3.0):

  • KeycacheTest.NegativeCacheTest
  • keycacheTest.RefreshTest
  • KeycacheTest.RefreshExpiredTest
  • KeycacheTest.LoadJwksTriggersRefreshWhenStale

(for reference, see for example gentoo/gentoo#45567 )
Thanks to @bbockelm for proposing this. 👍 </issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

When the SCITOKENS_SKIP_ONLINE_TESTS environment variable is set, all tests
that require network connectivity are skipped using GTEST_SKIP(). This allows
packagers and CI systems running in offline/network-sandboxed environments
to run the test suite without failures.

Skipped tests:
- KeycacheTest.RefreshTest
- KeycacheTest.RefreshInvalid
- KeycacheTest.RefreshExpiredTest
- KeycacheTest.NegativeCacheTest
- KeycacheTest.LoadJwksMissingTest
- KeycacheTest.LoadJwksTriggersRefreshWhenStale

Co-authored-by: djw8605 <79268+djw8605@users.noreply.github.com>
Copilot AI changed the title [WIP] Add test parameter to disable online tests for offline testing Add SCITOKENS_SKIP_ONLINE_TESTS env var to disable network-dependent tests Mar 7, 2026
@djw8605 djw8605 requested a review from Copilot March 13, 2026 20:38
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a mechanism to skip network-dependent GoogleTest cases in scitokens-cpp when running in offline / network-sandboxed packaging environments.

Changes:

  • Introduces SCITOKENS_SKIP_ONLINE_TESTS environment variable gating for online tests via GTEST_SKIP().
  • Applies the skip guard to the six KeycacheTest cases that depend on external network access.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +682 to +685
if (std::getenv("SCITOKENS_SKIP_ONLINE_TESTS")) {
GTEST_SKIP() << "Skipping online test (SCITOKENS_SKIP_ONLINE_TESTS is "
"set)";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test parameter to disable online tests (for offline testing)

3 participants