Commit graph

131 commits

Author SHA1 Message Date
Richard Hansen
281b7307a8 Fix misspelled *-ssl-validate option names
There is no `ssl-validate` option, and there never has been.
2024-05-10 16:54:40 -04:00
Richard Hansen
fedf0cbf40 Update ddclient::Test::Fake::HTTPD 2024-05-09 22:32:28 -04:00
Richard Hansen
01d1d5e142 Change t/geturl_connectivity.pl to handwritten
Commit a9c1e545fb removed the
`configure.ac` substitution, so the test no longer needs to be
generated.
2024-05-07 22:39:17 -04:00
Reuben Thomas
a9c1e545fb Require curl
Use command-line curl, and remove alternative Perl and Curl-via-Perl
implementations of network code.
2023-07-19 17:11:45 +03:00
Michal Josef Špaček
c4ff6c12bd Remove setting of MultiHomed, which is default in IO::Socket::IP
From doc in IO::Socket::IP in "IO::Socket::INET" INCOMPATIBILITES
section:
-----
The behaviour enabled by "MultiHomed" is in fact implemented by
"IO::Socket::IP" as it is required to correctly support searching for a
useable address from the results of the getaddrinfo(3) call. The
constructor will ignore the value of this argument, except if it is
defined but false. An exception is thrown in this case, because that
would request it disable the getaddrinfo(3) search behaviour in the
first place.
-----
2022-12-08 14:04:33 +01:00
Michal Josef Špaček
c747f2737a Rewrite deprecated use of IO::Socket::INET6 to new solution
Module IO::Socket::INET6 is deprecated.
There is common IO::Socket::IP module, which is working with ipv4 and
ipv6 in same way. There is backward compatibility with IO::Socket::INET6
2022-12-08 13:58:21 +01:00
David Kerr
1b2f45cc59 Add get_default_interface 2020-09-21 15:16:48 -04:00
David Kerr
213cf6ad09 Add get_ip_from_interface function 2020-09-21 15:16:11 -04:00
David Kerr
d24b75960d Add support for curl and option to not validate SSL certificates for getip from web or firewall
Check exists not just length
2020-08-07 11:17:44 -04:00
David Kerr
1ad4d6737a Add is_ipv6_global and extract_ipv6_global functions 2020-08-01 19:11:28 -04:00
Richard Hansen
310810c291 Group tests by IO::Socket class
Also delete some redundant SSL tests.
2020-07-24 15:23:54 -04:00
Richard Hansen
b46d064f55 Don't show -noipv6 when ipv6_opt is false 2020-07-24 15:18:42 -04:00
Richard Hansen
92a7590846 Whitespace fixes 2020-07-24 15:13:03 -04:00
Richard Hansen
5f1dacc3bd Eliminate unnecessary hashref
Pass the key-value pairs directly instead of via a hashref.
2020-07-11 21:39:48 -04:00
David Kerr
29202f5bc1 New is_ipv6 and extract_ipv6 algorithms
Also add unit tests.
2020-07-11 11:04:47 -04:00
David Kerr
92c1294af9 Accept leading zeros in IPv4 addresses
Also add unit tests.
2020-07-11 11:04:33 -04:00
Richard Hansen
a86f40ae9b Skip IPv6 tests if IO::Socket::INET6 isn't available
Fixes #251
2020-07-10 23:10:56 -04:00
Richard Hansen
bba1ecfe27 Switch from redefine to mock 2020-07-10 12:06:45 -04:00
Richard Hansen
173865bd75 Don't test writing to a read-only directory
root can always write to a read-only directory so the test was failing
on the CI runners (which run as root).
2020-07-10 12:06:45 -04:00
Richard Hansen
192a00ad64 Don't match against locale-dependent $! 2020-07-10 12:06:45 -04:00
Richard Hansen
4e1607c8f6 Enable autoflush on STDOUT and STDERR for tests
This prevents STDOUT lines from appearing out of order relative to
STDERR lines in the test log, which makes it much easier to understand
what's happening.

Devel::Autoflush is from https://metacpan.org/pod/Devel::Autoflush and
is licensed under the terms of the Apache 2.0 license.
2020-07-10 12:06:45 -04:00
Richard Hansen
dd8e376784 Add geturl SSL tests
These don't test validation, only that IO::Socket::SSL is used.
2020-07-08 13:40:31 -04:00
Richard Hansen
199e9125a4 Use subtest to group related tests
This reduces the output of `make check`, making it easier to zero in
on results of interest.
2020-07-07 13:01:15 -04:00
Richard Hansen
94aaff67cd Add Test::Simple v1.302175 to t/lib
The version of Test::More available in CentOS/RHEL 6 doesn't include
`subtest`, which we want to use. We can revert this commit once we
drop support for CentOS/RHEL 6.

The code is licensed under the same terms as Perl 5 itself:
https://github.com/Test-More/test-more/blob/v1.302175/LICENSE
2020-07-07 13:01:13 -04:00
Richard Hansen
ee8e1e8844 Don't abort if unable to write the cache file 2020-07-07 00:04:33 -04:00
Richard Hansen
6ae5fe62d7 Create /var/cache/ddclient if it doesn't exist
Fixes #76
2020-07-07 00:04:33 -04:00
Richard Hansen
323208e9cc Add geturl connectivity unit tests
Addresses #232
2020-07-05 18:36:46 -04:00
Richard Hansen
6d7d248f79 Improve parsing of config file assignments
* Ignore empty `key=value` strings in variable assignments. Now the
    following lines are supported with the expected meaning:
      * `a=1 , b=2`
      * `a=1,,b=2`
  * Improve the warning message when there is an unterminated quote.
  * Add a warning if the line ends with a backslash.

Also add unit tests.
2020-07-03 16:56:01 -04:00
Richard Hansen
a8212a397e Add a test for unexpected warnings 2020-06-30 00:40:26 -04:00
Richard Hansen
0cc83cd5ec Simplify runtime imports in test code
Also use `BAIL_OUT` instead of `die` if `require 'ddclient'` fails.
2020-06-29 17:26:46 -04:00
Richard Hansen
c390e75769 Add unit test infrastructure.
Now all that is needed to add a new unit test is to create a `t/*.pl`
file and list it in the `handwritten_tests` variable.

To run the test suite, run:

    ./autogen && ./configure && make check

Fixes #147
2020-06-29 11:08:32 -04:00