brainboxdotcc / DPP

C++ Discord API Bot Library - D++ is Lightweight and scalable for small and huge bots!
https://dpp.dev/
Apache License 2.0
1.07k stars 163 forks source link

1 test fails: ts_not_null() #1063

Closed yurivict closed 8 months ago

yurivict commented 10 months ago

Describe the bug

===>  Testing for dpp-discord-10.0.29
-- INFO: Explicitly disabling VCPKG as running inside the CI action.
-- AVX not supported by architecture amd64 AVX0
-- Checking for ability to update autogenerated files
-- Autogeneration is not available
-- Found Opus /usr/local/lib/libopus.so;/usr/lib/libm.so
-- Sodium 1.0.18
-- Detected libsodium and libopus. VOICE support will be enabled
-- Building stable version 10.0.29
-- Enabled experimental coroutine feature
-- Configuring test: soaktest with source: ../src/soaktest/*.cpp
-- Configuring test: unittest with source: ../src/unittest/*.cpp
Library install directory at /usr/local/lib
Include files install directory at /usr/local/include
-- Using external nlohmann::json
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /usr/ports/www/dpp/work/.build
ninja: no work to do.
[  0% 1/1] cd /usr/ports/www/dpp/work/.build && /usr/local/bin/ctest --force-new-ctest-process
Test project /usr/ports/www/dpp/work/.build
    Start 1: unittest
1/1 Test #1: unittest .........................***Failed   36.54 sec
[0.000]: [START] Running offline unit tests only.
[0.000]: [TESTING] manged object comparison
[0.000]: [SUCCESS] manged object comparison
[0.000]: [TESTING] Human readable error translation
[0.000]: [SUCCESS] Human readable error translation
[0.000]: [TESTING] Markdown escaping (ignore code block contents)
[0.000]: [TESTING] Markdown escaping (escape code block contents)
[0.000]: [SUCCESS] Markdown escaping (ignore code block contents)
[0.000]: [SUCCESS] Markdown escaping (escape code block contents)
[0.000]: [TESTING] URL encoding
[0.000]: [SUCCESS] URL encoding
[0.000]: [TESTING] Base 64 encoding
[0.000]: [SUCCESS] Base 64 encoding
[0.000]: [TESTING] https_client::get_host_info()
[0.000]: [SUCCESS] https_client::get_host_info()
[0.000]: [TESTING] https_client HTTP request
[0.162]: [SUCCESS] https_client HTTP request
[0.884]: [TESTING] utility::read_file()
[1.078]: [SUCCESS] utility::read_file()
[1.078]: [TESTING] ts_to_string()
[1.091]: [SUCCESS] ts_to_string()
[1.091]: [TESTING] role::operator<
[1.091]: [SUCCESS] role::operator<
[1.091]: [TESTING] webhook construct from URL
[1.091]: [SUCCESS] webhook construct from URL
[1.091]: [TESTING] dpp::snowflake class
[1.091]: [SUCCESS] dpp::snowflake class
[1.091]: [TESTING] dpp::json_interface class
[1.091]: [SUCCESS] dpp::json_interface class
[1.142]: [TESTING] interaction_create_t::get_parameter() with subcommands
[1.142]: [SUCCESS] interaction_create_t::get_parameter() with subcommands
[1.142]: [TESTING] interaction_create_t::get_parameter() without subcommands
[1.142]: [SUCCESS] interaction_create_t::get_parameter() without subcommands
[1.143]: [TESTING] command_option_choice::fill_from_json: double
[1.143]: [TESTING] command_option_choice::fill_from_json: int64_t
[1.143]: [TESTING] command_option_choice::fill_from_json: bool
[1.143]: [TESTING] command_option_choice::fill_from_json: snowflake
[1.143]: [TESTING] command_option_choice::fill_from_json: string
[1.143]: [SUCCESS] command_option_choice::fill_from_json: double
[1.143]: [SUCCESS] command_option_choice::fill_from_json: int64_t
[1.143]: [SUCCESS] command_option_choice::fill_from_json: bool
[1.143]: [SUCCESS] command_option_choice::fill_from_json: snowflake
[1.143]: [SUCCESS] command_option_choice::fill_from_json: string
[1.143]: [TESTING] permission
[1.143]: [SUCCESS] permission
[1.143]: [TESTING] event class
[1.143]: [SUCCESS] event class
[1.143]: [TESTING] user::get_mention
[1.143]: [SUCCESS] user::get_mention
[1.143]: [TESTING] user::format_username
[1.143]: [SUCCESS] user::format_username
[1.143]: [TESTING] user::get_creation_time
[1.143]: [SUCCESS] user::get_creation_time
[1.143]: [TESTING] user::get_url
[1.143]: [SUCCESS] user::get_url
[1.143]: [TESTING] utility::avatar_size
[1.143]: [SUCCESS] utility::avatar_size
[1.143]: [TESTING] utility::cdn_endpoint_url_hash
[1.143]: [SUCCESS] utility::cdn_endpoint_url_hash
[1.143]: [TESTING] sticker::get_url aka utility::cdn_endpoint_url_sticker
[1.143]: [SUCCESS] sticker::get_url aka utility::cdn_endpoint_url_sticker
[1.143]: [TESTING] user::get_avatar_url
[1.144]: [SUCCESS] user::get_avatar_url
[1.144]: [TESTING] emoji::get_url
[1.144]: [SUCCESS] emoji::get_url
[1.144]: [TESTING] message::get_url
[1.144]: [SUCCESS] message::get_url
[1.144]: [TESTING] channel::set_type
[1.144]: [SUCCESS] channel::set_type
[1.144]: [TESTING] channel::get_mention
[1.144]: [SUCCESS] channel::get_mention
[1.144]: [TESTING] channel::get_url
[1.144]: [SUCCESS] channel::get_url
[1.144]: [TESTING] utility::guild_navigation
[1.144]: [SUCCESS] utility::guild_navigation
[1.144]: [TESTING] utility::iconhash
[1.144]: [SUCCESS] utility::iconhash
[1.144]: [TESTING] utility::make_url_parameters
[1.144]: [SUCCESS] utility::make_url_parameters
[1.144]: [TESTING] utility::markdown_escape
[1.144]: [SUCCESS] utility::markdown_escape
[1.144]: [TESTING] utility::tokenize
[1.144]: [SUCCESS] utility::tokenize
[1.144]: [TESTING] utility::url_encode
[1.144]: [SUCCESS] utility::url_encode
[1.144]: [TESTING] utility::slashcommand_mention
[1.144]: [SUCCESS] utility::slashcommand_mention
[1.144]: [TESTING] utility::channel_mention
[1.144]: [SUCCESS] utility::channel_mention
[1.144]: [TESTING] utility::user_mention
[1.144]: [SUCCESS] utility::user_mention
[1.144]: [TESTING] utility::role_mention
[1.144]: [SUCCESS] utility::role_mention
[1.144]: [TESTING] utility::emoji_mention
[1.144]: [SUCCESS] utility::emoji_mention
[1.144]: [TESTING] utility::user_url
[1.144]: [SUCCESS] utility::user_url
[1.144]: [TESTING] utility::message_url
[1.144]: [SUCCESS] utility::message_url
[1.144]: [TESTING] utility::channel_url
[1.144]: [SUCCESS] utility::channel_url
[1.144]: [TESTING] utility::thread_url
[1.144]: [SUCCESS] utility::thread_url
[1.144]: [TESTING] ts_not_null()
[1.167]: [FAILED] ts_not_null()
[1.167]: [TESTING] coro: offline job
[1.167]: [TESTING] coro: offline task
[1.167]: [TESTING] coro: offline coroutine
[1.167]: [TESTING] coro: offline async
[1.168]: [TESTING] Instantiate DPP cluster
[1.168]: [SUCCESS] Instantiate DPP cluster
[1.168]: [TESTING] utility::iconhash
[1.168]: [SUCCESS] utility::iconhash
[1.168]: [TESTING] run_once<T>
[1.168]: [SUCCESS] run_once<T>
[1.506]: [TESTING] Instantiate a cache
[1.506]: [SUCCESS] Instantiate a cache
[6.180]: [SUCCESS] coro: offline async
[11.186]: [SUCCESS] coro: offline job
[21.181]: [SUCCESS] coro: offline coroutine
[26.197]: [SUCCESS] coro: offline task

UNIT TEST SUMMARY
==================
dpp::snowflake class                                         PASS
dpp::json_interface class                                    PASS
Instantiate DPP cluster                                      PASS
cluster::start method                                        SKIPPED
Connection to client websocket                               SKIPPED
Creation of application command                              SKIPPED
Deletion of application command                              SKIPPED
Log events                                                   SKIPPED
Creation of a channel message                                SKIPPED
Editing a channel message                                    SKIPPED
Message edit event                                           SKIPPED
Deletion of a channel message                                SKIPPED
Receipt of a created message                                 SKIPPED
Message attachment send and check                            SKIPPED
Test guild cache                                             SKIPPED
Test user cache                                              SKIPPED
React to a message                                           SKIPPED
Reaction event                                               SKIPPED
Receive guild create event                                   SKIPPED
Get messages                                                 SKIPPED
crossplatform_strptime()                                     SKIPPED
utility::iconhash                                            PASS
cluster::current_user_get()                                  SKIPPED
cluster::guild_get()                                         SKIPPED
cluster::channel_get()                                       SKIPPED
cluster::channels_get()                                      SKIPPED
cluster::roles_get()                                         SKIPPED
cluster::guild_get_invites()                                 SKIPPED
cluster::guild_get_bans()                                    SKIPPED
cluster::channel_pins_get()                                  SKIPPED
cluster::guild_events_get()                                  SKIPPED
cluster::guild_event_get()                                   SKIPPED
message_create_t::send()                                     SKIPPED
cluster::guild_event_users_get()                             SKIPPED
start timer                                                  SKIPPED
stop timer                                                   SKIPPED
one-shot timer                                               SKIPPED
timed listener                                               SKIPPED
Presence intent                                              SKIPPED
Instantiate a cache                                          PASS
message_collector                                            SKIPPED
managed::get_creation_date()                                 SKIPPED
utility::read_file()                                         PASS
ts_to_string()                                               PASS
ts_not_null()                                                FAIL
command_option_choice::fill_from_json: double                PASS
command_option_choice::fill_from_json: int64_t               PASS
command_option_choice::fill_from_json: bool                  PASS
command_option_choice::fill_from_json: snowflake             PASS
command_option_choice::fill_from_json: string                PASS
https_client::get_host_info()                                PASS
https_client HTTPS request                                   SKIPPED
https_client HTTP request                                    PASS
run_once<T>                                                  PASS
webhook construct from URL                                   PASS
Markdown escaping (ignore code block contents)               PASS
Markdown escaping (escape code block contents)               PASS
URL encoding                                                 PASS
Base 64 encoding                                             PASS
sync<T>()                                                    SKIPPED
manged object comparison                                     PASS
find_channel()                                               SKIPPED
channel type flags                                           SKIPPED
create a forum channel                                       SKIPPED
retrieve the created forum channel                           SKIPPED
delete the created forum channel                             SKIPPED
Human readable error translation                             PASS
cluster::guild_edit                                          SKIPPED
cluster::guild_ban_add ban three deleted discord accounts    SKIPPED
cluster::guild_get_ban getting one of the banned accounts    SKIPPED
cluster::guild_get_bans get bans using the after-parameter   SKIPPED
cluster::guild_ban_delete unban the banned discord accounts  SKIPPED
cluster::thread_create                                       SKIPPED
cluster::on_thread_create event                              SKIPPED
cluster::channel_delete with thread                          SKIPPED
cluster::on_thread_delete event                              SKIPPED
cluster::thread_edit                                         SKIPPED
cluster::on_thread_update event                              SKIPPED
cluster::threads_get_active                                  SKIPPED
creating a voice channel                                     SKIPPED
editing the created voice channel                            SKIPPED
deleting the created voice channel                           SKIPPED
permission                                                   PASS
event class                                                  PASS
cluster::user_get                                            SKIPPED
cluster::user_get flag parsing                               SKIPPED
cluster::guild_get_member                                    SKIPPED
user::get_mention                                            PASS
user::get_url                                                PASS
user::format_username                                        PASS
user::get_creation_time                                      PASS
user::get_avatar_url                                         PASS
channel::set_type                                            PASS
channel::get_mention                                         PASS
channel::get_url                                             PASS
message::get_url                                             PASS
utility::guild_navigation                                    PASS
utility::iconhash                                            PASS
utility::make_url_parameters                                 PASS
utility::markdown_escape                                     PASS
utility::tokenize                                            PASS
utility::url_encode                                          PASS
utility::slashcommand_mention                                PASS
utility::channel_mention                                     PASS
utility::user_mention                                        PASS
utility::role_mention                                        PASS
utility::emoji_mention                                       PASS
utility::user_url                                            PASS
utility::message_url                                         PASS
utility::channel_url                                         PASS
utility::thread_url                                          PASS
utility::avatar_size                                         PASS
utility::cdn_endpoint_url_hash                               PASS
sticker::get_url aka utility::cdn_endpoint_url_sticker       PASS
emoji::get_url                                               PASS
role::operator<                                              PASS
cluster::role_create                                         SKIPPED
cluster::role_edit                                           SKIPPED
cluster::role_delete                                         SKIPPED
JSON parse error for post_rest                               SKIPPED
cluster::user_get_cached_sync() with present member          SKIPPED
cluster::user_get_cached_sync() with not present member      SKIPPED
interaction_create_t::get_parameter() with subcommands       PASS
interaction_create_t::get_parameter() without subcommands    PASS
cluster::automod_rule_create                                 SKIPPED
cluster::automod_rule_get                                    SKIPPED
cluster::automod_rules_get                                   SKIPPED
cluster::automod_rule_delete                                 SKIPPED
using the cluster::request meth__cxa_thread_call_dtors: dtr 0x3a08d0 from unloaded dso, skipping
od to fetch an image          SKIPPED
cluster::guild_emoji_create                                  SKIPPED
cluster::guild_emoji_get                                     SKIPPED
cluster::guild_emoji_delete                                  SKIPPED
cluster::on_invite_create                                    SKIPPED
cluster::on_invite_delete                                    SKIPPED
cluster::channel_invite_create                               SKIPPED
cluster::invite_get                                          SKIPPED
cluster::invite_delete                                       SKIPPED
multiheader cookie test                                      SKIPPED
Connect to voice channel                                     SKIPPED
Send audio to voice channel                                  SKIPPED
Pinning a channel message                                    SKIPPED
Unpinning a channel message                                  SKIPPED
cluster::thread_member_add                                   SKIPPED
cluster::thread_member_get                                   SKIPPED
cluster::thread_members_get                                  SKIPPED
cluster::thread_member_remove                                SKIPPED
cluster::on_thread_members_update event with member addition SKIPPED
cluster::on_thread_members_update event with member removal  SKIPPED
cluster::thread_create_with_message                          SKIPPED
message manipulation in thread                               SKIPPED
cluster::on_message_create in thread                         SKIPPED
cluster::on_message_edit in thread                           SKIPPED
cluster::on_message_delete in thread                         SKIPPED
cluster::on_reaction_add in thread                           SKIPPED
cluster::on_reaction_remove in thread                        SKIPPED
coro: offline job                                            PASS
coro: offline coroutine                                      PASS
coro: offline task                                           PASS
coro: offline async                                          PASS
coro: online event handler                                   SKIPPED
coro: online api calls                                       SKIPPED
coro: online mumbo jumbo in event handler                    SKIPPED

Execution finished in 36.520 seconds.
Failed: 1 Passed: 59 Skipped: 102 Percentage: 98.33%

0% tests passed, 1 tests failed out of 1

Total Test time (real) =  36.54 sec

The following tests FAILED:
          1 - unittest (Failed)
Errors while running CTest
FAILED: CMakeFiles/test.util 

To Reproduce Regular build + test.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

System Details:

Jaskowicz1 commented 10 months ago

Hi there! What timezone are you in? If the machine you ran this from isn't in the same timezone, then can you tell us what timezone the machine is in?

yurivict commented 10 months ago

PST

Mishura4 commented 10 months ago

This test will fail on any machine that isn't UTC

yurivict commented 10 months ago

To be precise: The hardware clock is in UTC, the user-level timezone is PST.

Mishura4 commented 10 months ago

yes

yurivict commented 10 months ago

Maybe you can consider to adjust this case so that it wouldn't assume UTC.

Mishura4 commented 10 months ago

Maybe PR welcome 😃

braindigitalis commented 10 months ago

To be precise: The hardware clock is in UTC, the user-level timezone is PST.

time(nullptr) should return an epoch time based around UTC. It is not, iirc, so this is why this is happening. Are you sure the BIOS clock is correctly set to UTC?

yurivict commented 10 months ago

Yes, the BIOS time is in UTC, and time(nullptr) matches what Internet says the UTC time is.

Jaskowicz1 commented 9 months ago

I feel maybe it's something we should look at rewriting. Whilst it may work for those that live in the UK (like myself), the test fails for people like @Mishura4 as they live in the US.

I'm assuming the user-level timezone is the reason ts_not_null doesn't work, as my mac's VM saw the same issue when the VM decided to set the clock to PST instead of GMT.

Jaskowicz1 commented 8 months ago

awaiting #1080 results, will look to rewrite timestamp test afterwards.

Jaskowicz1 commented 8 months ago

Closed #1080 due to no progress, will look to do this in the next coming days.

Jaskowicz1 commented 8 months ago

A fix for this has now been merged!