MessageParserFixture.ALinkIsParsedCorrectly test depends on Internet connectivity (otherwise segfaults)
Hi! Updating to 20231222.2, I see this new test failure with GNU Guix:
[----------] 5 tests from MessageParserFixture
[ RUN ] MessageParserFixture.TextIsParsedCorrectly
[ OK ] MessageParserFixture.TextIsParsedCorrectly (4999 ms)
[ RUN ] MessageParserFixture.ALinkIsParsedCorrectly
/tmp/guix-build-jami-20231222.2.drv-0/source/tests/unittests/messageparser_unittest.cpp:99: Failure
Expected equality of these values:
linkInfoReadySpy.count()
Which is: 0
1
Looking at the test, that's probably because it expects to be able to reach out to google.com:
TEST_F(MessageParserFixture, ALinkIsParsedCorrectly)
{
auto linkColor = QColor::fromRgb(0, 0, 255);
auto backgroundColor = QColor::fromRgb(0, 0, 255);
QSignalSpy messageParsedSpy(globalEnv.messageParser.data(), &MessageParser::messageParsed);
QSignalSpy linkInfoReadySpy(globalEnv.messageParser.data(), &MessageParser::linkInfoReady);
// Parse a message with a link.
globalEnv.messageParser->parseMessage("msgId_02",
"https://www.google.com",
true,
linkColor,
backgroundColor);
// Wait for the messageParsed signal which should be emitted once.
messageParsedSpy.wait();
EXPECT_EQ(messageParsedSpy.count(), 1);
QList<QVariant> messageParserArguments = messageParsedSpy.takeFirst();
EXPECT_TRUE(messageParserArguments.at(0).typeId() == qMetaTypeId<QString>());
EXPECT_EQ(messageParserArguments.at(0).toString(), "msgId_02");
EXPECT_TRUE(messageParserArguments.at(1).typeId() == qMetaTypeId<QString>());
EXPECT_EQ(messageParserArguments.at(1).toString(),
"<style>a{color:#0000ff;}</style><p><a "
"href=\"https://www.google.com\">https://www.google.com</a></p>\n");
// Wait for the linkInfoReady signal which should be emitted once.
linkInfoReadySpy.wait();
EXPECT_EQ(linkInfoReadySpy.count(), 1);
QList<QVariant> linkInfoReadyArguments = linkInfoReadySpy.takeFirst();
EXPECT_TRUE(linkInfoReadyArguments.at(0).typeId() == qMetaTypeId<QString>());
EXPECT_EQ(linkInfoReadyArguments.at(0).toString(), "msgId_02");
EXPECT_TRUE(linkInfoReadyArguments.at(1).typeId() == qMetaTypeId<QVariantMap>());
QVariantMap linkInfo = linkInfoReadyArguments.at(1).toMap();
EXPECT_EQ(linkInfo["url"].toString(), "https://www.google.com");
// The rest of the link info is not tested here.
}
I'm building this with GNU Guix, which uses a networkless controlled environment for the build.
Perhaps network-dependent tests should be skipped when there's no connectivity, or via some build option.