Hi everyone, quick question: I was wondering what ...
# general
a
Hi everyone, quick question: I was wondering what exactly "no state" means 🤔 this is with the fix for users/groups table so 5.3.0 All tests for users and groups are failing like this.
Copy code
[ RUN      ] UserGroups.test_sanity
E20220607 10:13:31.404719  9192 virtual_table.cpp:1006] Exception while executing table user_groups: no state
C:\workspace\senseon-enterprise-endpoint\tests\integration\tables\helper.cpp(160): error: Value of: status.ok()
  Actual: false
Expected: true
Query execution failed with error: "no state"
C:\workspace\senseon-enterprise-endpoint\tests\integration\tables\user_groups.cpp(62): error: Expected: (data.size()) > (0ul), actual: 0 vs 0
[  FAILED  ] UserGroups.test_sanity (1 ms)
s
Hello Andrea! Does osqueryi works when trying to query the users or groups table, or it fails there too?
also, how the tests were run? what was the command line?
oh I see the tests throwing exceptions in the CI, but not failing, because we catch the exceptions and transform them in an empty response. One issue I see (and hopefully the only one), is that I forgot to do the dance of starting up the needed services for some of the tests that query tables that internally use the users or groups cache Although it’s strange that it’s actually failing for you on the test suite which actually initializes the needed services.
a
TBF is not osquery vanilla that's why I asked only what could "no state" mean.
s
I see; it’s an exception thrown by accessing a
std::future
that has not been initialized properly from a
std::promise
. They are some internals used to synchronize the initialization of the users and groups cache. I’ve opened a couple of PRs to fix the tests https://github.com/osquery/osquery/pull/7620 and to not hide this and other similar issues anymore in the future https://github.com/osquery/osquery/pull/7621
a
ctest --output-on-failure --config RelWithDebInfo
was the command. Installed osquery and run osqueryi and correctly returns results for those tables
*-C RelWithDebInfo
s
🤦
yeah that was me testing that exceptions would go through with the change on the other PR
a
yeah no worries, it happens.
s
Anyway, thanks for catching these issues!
a
✌️
unfortunately no joy for me.. I still see the std::future_error exception being thrown 🤔 is
s
Does the official build of the tests behaves the same?
a
I haven't tried to build from scratch but it looks like I am going to..
I wonder if I am missing some global initialisation..
s
What has been fixed by PR 7620 is indeed some missing initialization for some of the tests that were using the users or groups cache indirectly. The initialization is done in the test itself. I’m not sure what the code you’re compiling looks like, that’s why I was wondering if it happened the same with the upstream source code.
a
yeah that s what I thought
FYI on the osquery branch 5.3.0 the tests are working fine.
Just an heads up.. it looks like the static method to initialise the Test Suite it is called
SetUpTestCase
(https://github.com/osquery/osquery/blob/a7d856968ac515c2c02b2cac7db237e1b2bf55f5/tests/integration/tables/certificates.cpp#L32)
or possibly we are using different version of google test 🤔 didn't get a compiler error though
s
a
ah yeah that makes sense