Commit Graph

86 Commits

Author SHA1 Message Date
Miek Gieben 388f6eea29
Tests updates (#556)
Use :0 for loopback testing. This is more portable between testing environments.
Add testRR that calls NewRR and throws error away - apply it everywhere where needed.

It seems only Go 1.9 can deal with :0 being used. Disable 1.8 in travis.
2017-11-08 10:01:19 +00:00
Miek Gieben 348c84f37e
Test: remove all Logf/Log (#547)
Move some of them to Errorf and friends, but most of them are just
gone: This make go test -v actually readable.

Remove a bunch of test that used ipv6 on localhost as this does not work
on Travis.
2017-11-03 15:50:01 +00:00
Miek Gieben f520760857 Lowercase all error msg from the tests 2015-11-26 14:12:38 +00:00
Filippo Valsorda e9635cc83b Fix (*HINFO).len() and HINFO canonicalization in rawSignatureData 2015-10-05 14:37:42 +01:00
Filippo Valsorda 034c247229 Refactor DNSSEC to use crypto.{PrivateKey,Signer}
This will allow RRSIG.Sign to use generic crypto.Signer implementations.

This is a interface breaking change, even if the required changes are most
likely just type asserions from crypto.PrivateKey to the underlying type or
crypto.Signer.
2015-08-19 17:51:02 +01:00
Aaron Lehmann 2cee5e58b0 Rename isValidRRSet to IsRRset, and move it to defaults.go 2015-06-28 17:04:05 -07:00
Aaron Lehmann f605c832f0 Remove isValidRRSet check from RRSIG Sign method
Change suggested by miekg, since the caller may already know it's
passing a proper RRset.

Update unit test to call isValidRRSet directly instead of expecting Sign
to return an error for sets the fail the check.
2015-06-28 16:57:40 -07:00
Aaron Lehmann dc56846101 Check that the RRs passed to Sign and Verify form a valid RFC2181 RRSet
Add a sanity check used by RRSig's Sign and Verify functions making sure
that the records they operate on form a valid RRSet (same name, type,
and class).

Add a unit test TestInvalidRRSet that calls RRSig's Sign and Verify
methods with invalid RRSets, and makes sure the correct error is
returned.
2015-06-04 11:13:49 -07:00
Michael Haro 2fb2a25e84 More test clean up
Remove trailing \n from t.Log and t.Error messages as it's unnecessary.

In some instances, combine multiple t.Error()s into one

To provide more consistency across the tests, rename e to err and use %v
as the format arg for errors.

Replace Logf and Errorf with Log and Error when it made sense.  For
example t.Errorf("%v", err) to t.Error(err)
2015-02-25 22:14:21 -08:00
Michael Haro f995f1aff3 Convert tests from being t.Log(..) then t.Fail() to just t.Error(...) as
t.Error(...) does both and makes it more clear which messages are errors
vs information log messages.
2015-02-23 17:43:07 -08:00
Matthew Farrellee 24ccdb3008 fix spelling of separate 2015-02-18 17:04:12 -05:00
Filippo Valsorda e9faa971b3 Refactor the DNSSEC private key code
Now PrivateKey is an interface exposing Sign() and String(). Common
implementations are wrappers for {rsa|dsa|ecdsa}.PrivateKey but
this allows for custom signers, and abstracts away the private-ops
code to a single place.
2015-01-23 13:04:29 -08:00
Filippo Valsorda 3fd8a8eef6 Fix: RSA key export and its test 2015-01-22 22:02:20 -08:00
Filippo Valsorda bcc05715b3 Make some ECDSA failures more informative/accurate 2014-12-05 18:39:06 +00:00
Miek Gieben 5fc7e36983 go test -short
Added a bunch a long running test function to the list of skipped
tests when giving -short to go test. Tests are bascially *all*
DNSSEC key generation tests and 1 serving test.

PASS
ok      github.com/miekg/dns    0.782s

Compared to 13+ s, so quite a bit faster.
2014-11-12 10:19:20 +00:00
Miek Gieben 0aa3021a83 Remove all copyright notices
Use the central COPYRIGHT file.
2014-09-11 20:57:37 +01:00
Miek Gieben cf89d7a324 Remove Copyrights from there 2014-09-11 20:53:14 +01:00
Miek Gieben 518ab47648 Move the tests into the existing _test.go files. 2014-09-11 20:49:20 +01:00
Filippo Valsorda 72f550b0ec Fix NewPrivateKey ECDSA parsing, and add test 2014-09-10 17:04:39 -07:00
Miek Gieben ad58c7b338 Disabled two failing ECDSA tests 2014-09-09 07:53:09 +01:00
Miek Gieben 6ecd49ff89 Fix ECDSA algorithms
Current code was completely wrong, so validation of ECDSA didn't work.
The new tests now works, the old one now doesn't
2014-09-09 07:51:15 +01:00
Miek Gieben 643720d10d Fix ECDSA algorithms
Current code was completely wrong, so validation of ECDSA didn't work.
The new tests now works, the old one now doesn't
2014-09-09 07:45:47 +01:00
Miek Gieben 818abf8202 Lowercase the Test to test 2014-09-05 08:47:23 +01:00
Miek Gieben 4b1fbc358e Cleanup the test a bit 2014-09-05 08:44:31 +01:00
Miek Gieben 919e4f9daf Add extra (failing) sign/verify test 2014-09-05 08:27:22 +01:00
Miek Gieben 53aa7cebbf Add test for SRV signing 2014-02-02 19:25:55 +00:00
Miek Gieben 9c75b3cdc2 Fi the tests too 2014-01-27 14:45:34 +00:00
Miek Gieben 70ee966106 Fix the unknown record sign test
Don't make up new error in msg.Pack when there are perfectly fine
errors to return.
2013-12-06 09:43:26 +00:00
Miek Gieben 6c9cc37ac3 Small tweaks to the pull request from Alex 2013-12-06 07:46:08 +00:00
Miek Gieben 110f6c9ea7 Test for TYPE65534 records, copy now copies slices correctly 2013-12-06 07:37:48 +00:00
Miek Gieben ee8ace0477 Merge branch 'master' of github.com:miekg/dns 2013-09-11 08:22:23 +01:00
Miek Gieben 9c1ee5d5ca Update IsDomainName
This new functions just compiles the domain to wire format, if that
works, the name is deemed OK. It is also much less strict than the
older code. Almost everything is allowed in the name, except two
dots back to back (there is an explicit test for that).
2013-09-10 18:09:22 +00:00
Miek Gieben a5ac1f46ee ...and fix the imports for the test files 2013-09-09 22:20:48 +01:00
Miek Gieben 81d35ce537 Move some functions to the correct file
DNSSEC tests go in dnssec_test.go
2013-09-09 22:19:24 +01:00
Miek Gieben f595bf7a06 Set license on test files 2013-05-12 16:09:52 +02:00
Miek Gieben d53d9eab81 gofmt 2013-05-05 20:30:44 +02:00
Miek Gieben 26994c382b gofmt 2013-01-28 14:34:18 +01:00
Miek Gieben 9977bf87c4 Drop unneeded packages 2012-12-14 12:42:39 +01:00
Miek Gieben 235e892dfc Rename the RR types drop the RR_ prefix
This is also done in the official Go library. It also make the
code shorter.
2012-12-09 19:23:25 +01:00
Miek Gieben dda096049e more tests 2012-04-18 12:13:44 +02:00
Miek Gieben 872dc4fc6b Make the private key reading more natural 2012-04-15 20:55:25 +02:00
Miek Gieben b58c604e17 Add symmetry to the reading of public/private keys
Add a NewPrivateKey that works on strings and calls ReadPrivateKey
that works on io.Readers.
2012-04-15 20:50:53 +02:00
Miek Gieben edf4b3d11b Test signing with ecdsa 2012-04-11 15:13:17 +02:00
Miek Gieben a55014ff8a elliptic curve stuff 2012-04-11 14:32:44 +02:00
Miek Gieben 537b644ed2 Fix the Makefile-less go version of dns 2012-02-05 10:53:15 +01:00
Miek Gieben 09ac6c8dc5 gofmt 2012-01-28 00:35:37 +01:00
Miek Gieben 6e6b67afd5 Fix NSEC(3) with no bitmap 2012-01-23 11:30:26 +01:00
Miek Gieben 74181dee8e More tests 2012-01-22 20:44:52 +01:00
Miek Gieben d78647b17d Typo in test 2012-01-22 19:56:13 +01:00
Miek Gieben 3159bab78c more testing stuff 2012-01-22 19:08:47 +01:00