Skip to content

Guard access control dependent tests when OPENDAQ_ENABLE_ACCESS_CONTROL is OFF - #40

Merged
JakaMohorko merged 1 commit into
mainfrom
claude/access-control-off-tests
Sep 30, 2026
Merged

JakaMohorko merged 1 commit into
mainfrom
claude/access-control-off-tests

Conversation

@dejancrn

Copy link
Copy Markdown
Contributor

Summary

When openDAQ is built with OPENDAQ_ENABLE_ACCESS_CONTROL=OFF, the permission manager is a stub that grants every request, so tests that assert an access denial cannot pass. This compiles those tests only when access control is enabled:

  • Tms*Test.Permissions in the opcuatms_server tests (channel, DAQ server component, device, function block, input port, property, property object, signal, value)
  • AsseccPTest.* and its instantiation in opcuatms_server/tests/test_tms_user_access.cpp
  • In tests/opcuatms_integration/test_tms_user_access.cpp: TmsUserAccessTest.Anonymous, CommonUser, CommonUserForRootDevice, and all TmsUserAccessPTest cases except CommonChecks

Authentication tests (ConnectAnonymousNotAllowed, ConnectionPTest.UserConnectTest, CreateClientDevice, CommonChecks) do not depend on permissions and stay enabled.

OPENDAQ_ENABLE_ACCESS_CONTROL is a public compile definition of openDAQ's coreobjects, so it reaches these test targets through their openDAQ dependencies.

Testing

Built openDAQ (full preset, Debug, MSVC, Ninja) with this module twice, once with access control OFF and once ON:

  • OFF, before this change: the tests above fail in test_opcuatms_server and test_opcuatms_integration; with the change they are compiled out and both binaries pass.
  • ON: all tests are still built and pass.

The companion openDAQ change is openDAQ/openDAQ#1329.

🤖 Generated with Claude Code

…OL is OFF

With access control disabled in openDAQ the permission manager grants every
request, so tests asserting a denial cannot pass. Compile them only when
access control is enabled:

- Tms*Test.Permissions in opcuatms_server tests
- AsseccPTest.* in opcuatms_server test_tms_user_access.cpp
- TmsUserAccessTest.Anonymous/CommonUser/CommonUserForRootDevice and all
  TmsUserAccessPTest cases except CommonChecks in the integration tests

Authentication tests (connect/login) are unaffected and stay enabled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dejancrn dejancrn self-assigned this Sep 28, 2026
@JakaMohorko
JakaMohorko requested review from JakaMohorko and removed request for denise-opendaq September 30, 2026 05:22
@JakaMohorko
JakaMohorko merged commit f3d222b into main Sep 30, 2026
20 checks passed
@JakaMohorko
JakaMohorko deleted the claude/access-control-off-tests branch September 30, 2026 05:22
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.

2 participants