Skip to content

Commit

Permalink
Check for and discard expected warning from MaybeAddAuth
Browse files Browse the repository at this point in the history
MaybeAddAuth() here tells us that it refused to use the credentials
for an http source; but that caused the test suite to fail at a later
stage because we checked if there were any errors/warning. Strangely,
this is only triggered with LTO enabled.

Actually check that the warning is being set and then reject it.
  • Loading branch information
julian-klode committed Mar 31, 2021
1 parent 0d25ce3 commit 8613225
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/libapt/authconf_test.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <config.h>

#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/netrc.h>
#include <apt-pkg/strutl.h>
Expand Down Expand Up @@ -235,11 +236,15 @@ machine http://http.example login foo1 password bar
EXPECT_EQ("foo1", U.User);
EXPECT_EQ("bar", U.Password);

_error->PushToStack();
EXPECT_TRUE(fd.Seek(0));
U = URI("http://https.example/foo");
EXPECT_TRUE(MaybeAddAuth(fd, U));
EXPECT_TRUE(U.User.empty());
EXPECT_TRUE(U.Password.empty());
EXPECT_FALSE(_error->empty());
EXPECT_TRUE(U.Password.empty());
_error->RevertToStack();

EXPECT_TRUE(fd.Seek(0));
U = URI("http://http.example/foo");
Expand Down

0 comments on commit 8613225

Please sign in to comment.