Title
#general
a

Andrea

06/07/2022, 10:32 AM
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.
[ 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)
Stefano Bonicatti

Stefano Bonicatti

06/07/2022, 10:51 AM
Hello Andrea! Does osqueryi works when trying to query the users or groups table, or it fails there too?
10:58 AM
also, how the tests were run? what was the command line?
11:32 AM
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

Andrea

06/07/2022, 12:55 PM
TBF is not osquery vanilla that's why I asked only what could "no state" mean.
Stefano Bonicatti

Stefano Bonicatti

06/07/2022, 12:57 PM
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

Andrea

06/07/2022, 12:57 PM
ctest --output-on-failure --config RelWithDebInfo
was the command. Installed osquery and run osqueryi and correctly returns results for those tables
1:21 PM
*-C RelWithDebInfo
Stefano Bonicatti

Stefano Bonicatti

06/07/2022, 1:38 PM
🤦
1:44 PM
yeah that was me testing that exceptions would go through with the change on the other PR
a

Andrea

06/07/2022, 1:46 PM
yeah no worries, it happens.
Stefano Bonicatti

Stefano Bonicatti

06/07/2022, 1:47 PM
Anyway, thanks for catching these issues!
a

Andrea

06/07/2022, 1:48 PM
3:17 PM
unfortunately no joy for me.. I still see the std::future_error exception being thrown 🤔 is
Stefano Bonicatti

Stefano Bonicatti

06/07/2022, 3:19 PM
Does the official build of the tests behaves the same?
a

Andrea

06/07/2022, 3:19 PM
I haven't tried to build from scratch but it looks like I am going to..
3:22 PM
I wonder if I am missing some global initialisation..
Stefano Bonicatti

Stefano Bonicatti

06/07/2022, 3:25 PM
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

Andrea

06/07/2022, 3:30 PM
yeah that s what I thought
8:59 AM
FYI on the osquery branch 5.3.0 the tests are working fine.
5:17 PM
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)
5:28 PM
or possibly we are using different version of google test 🤔 didn't get a compiler error though
Stefano Bonicatti

Stefano Bonicatti

06/11/2022, 5:28 PM
a

Andrea

06/11/2022, 7:40 PM
ah yeah that makes sense