test: fix test issue.
This commit is contained in:
@@ -39,16 +39,10 @@ TEST(Bind, tls)
|
||||
|
||||
server.Start(R"""(bind [::]:61053
|
||||
server-tls 127.0.0.1:60053 -no-check-certificate
|
||||
log-num 0
|
||||
log-console yes
|
||||
log-level debug
|
||||
cache-persist no)""");
|
||||
)""");
|
||||
server_wrap.Start(R"""(bind-tls [::]:60053
|
||||
address /example.com/1.2.3.4
|
||||
log-num 0
|
||||
log-console yes
|
||||
log-level debug
|
||||
cache-persist no)""");
|
||||
)""");
|
||||
smartdns::Client client;
|
||||
ASSERT_TRUE(client.Query("example.com", 61053));
|
||||
ASSERT_EQ(client.GetAnswerNum(), 1);
|
||||
@@ -69,16 +63,10 @@ TEST(Bind, https)
|
||||
|
||||
server.Start(R"""(bind [::]:61053
|
||||
server https://127.0.0.1:60053 -no-check-certificate
|
||||
log-num 0
|
||||
log-console yes
|
||||
log-level debug
|
||||
cache-persist no)""");
|
||||
)""");
|
||||
server_wrap.Start(R"""(bind-https [::]:60053
|
||||
address /example.com/1.2.3.4
|
||||
log-num 0
|
||||
log-console yes
|
||||
log-level debug
|
||||
cache-persist no)""");
|
||||
)""");
|
||||
smartdns::Client client;
|
||||
ASSERT_TRUE(client.Query("example.com", 61053));
|
||||
ASSERT_EQ(client.GetAnswerNum(), 1);
|
||||
@@ -103,10 +91,7 @@ TEST(Bind, udp_tcp)
|
||||
bind [::]:60053
|
||||
bind-tcp [::]:60053
|
||||
server 127.0.0.1:61053
|
||||
log-num 0
|
||||
log-console yes
|
||||
log-level debug
|
||||
cache-persist no)""");
|
||||
)""");
|
||||
smartdns::Client client;
|
||||
ASSERT_TRUE(client.Query("a.com +tcp", 60053));
|
||||
std::cout << client.GetResult() << std::endl;
|
||||
@@ -141,10 +126,7 @@ bind [::]:60053 -group self
|
||||
server 127.0.0.1:61053 -group self
|
||||
bind [::]:61053 -group upstream
|
||||
server 127.0.0.1:62053 -group upstream
|
||||
log-num 0
|
||||
log-console yes
|
||||
log-level info
|
||||
cache-persist no)""");
|
||||
)""");
|
||||
smartdns::Client client;
|
||||
|
||||
ASSERT_TRUE(client.Query("a.com", 60053));
|
||||
@@ -174,10 +156,7 @@ TEST(Bind, nocache)
|
||||
bind [::]:60053 --no-cache
|
||||
bind-tcp [::]:60053
|
||||
server 127.0.0.1:61053
|
||||
log-num 0
|
||||
log-console yes
|
||||
log-level debug
|
||||
cache-persist no)""");
|
||||
)""");
|
||||
smartdns::Client client;
|
||||
ASSERT_TRUE(client.Query("a.com", 60053));
|
||||
std::cout << client.GetResult() << std::endl;
|
||||
@@ -213,10 +192,7 @@ TEST(Bind, device)
|
||||
server.Start(R"""(
|
||||
bind [::]:60053@lo
|
||||
server 127.0.0.1:62053
|
||||
log-num 0
|
||||
log-console yes
|
||||
log-level info
|
||||
cache-persist no)""");
|
||||
)""");
|
||||
smartdns::Client client;
|
||||
|
||||
ASSERT_TRUE(client.Query("a.com", 60053));
|
||||
@@ -244,10 +220,8 @@ TEST(Bind, malformed_packet)
|
||||
server.Start(R"""(
|
||||
bind [::]:60053@lo
|
||||
server 127.0.0.1:62053
|
||||
log-num 0
|
||||
log-console yes
|
||||
log-level info
|
||||
cache-persist no)""");
|
||||
)""");
|
||||
|
||||
int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
ASSERT_NE(sockfd, -1);
|
||||
@@ -283,7 +257,6 @@ cache-persist no)""");
|
||||
EXPECT_EQ(client.GetAnswer()[0].GetData(), "1.2.3.4");
|
||||
}
|
||||
|
||||
|
||||
TEST(Bind, group)
|
||||
{
|
||||
smartdns::MockServer server_upstream;
|
||||
@@ -324,10 +297,7 @@ bind [::]:60253 -group g2
|
||||
server 127.0.0.1:61053
|
||||
server 127.0.0.1:62053 -group g1 -exclude-default-group
|
||||
server 127.0.0.1:63053 -group g2 -exclude-default-group
|
||||
log-num 0
|
||||
log-console yes
|
||||
log-level debug
|
||||
cache-persist no)""");
|
||||
)""");
|
||||
smartdns::Client client;
|
||||
ASSERT_TRUE(client.Query("a.com", 60053));
|
||||
std::cout << client.GetResult() << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user