* Add a setup test for middleware/file

This fix adds a setup test for middleware/file so that there is
a basic coverage for the Corefile processing of middleware/file.

This fix is related to 308 (Will look into it).

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* middleware/file: use helper function for test

Fixup setup_test.go and use the test.TempFile function to make things
somewhat shorter.

Use clean up the use of testing.T in TempFile - it is not used.
This commit is contained in:
Miek Gieben 2016-10-02 15:58:01 +01:00 committed by GitHub
parent e54c232c8c
commit 4096c4906d
12 changed files with 82 additions and 19 deletions

View file

@ -32,8 +32,8 @@ func TestZoneSigningDouble(t *testing.T) {
defer rm1()
defer rm2()
fPriv1, rmPriv1, _ := test.TempFile(t, ".", privKey1)
fPub1, rmPub1, _ := test.TempFile(t, ".", pubKey1)
fPriv1, rmPriv1, _ := test.TempFile(".", privKey1)
fPub1, rmPub1, _ := test.TempFile(".", pubKey1)
defer rmPriv1()
defer rmPub1()
@ -57,8 +57,8 @@ func TestZoneSigningDouble(t *testing.T) {
// TestSigningDifferentZone tests if a key for miek.nl and be used for example.org.
func TestSigningDifferentZone(t *testing.T) {
fPriv, rmPriv, _ := test.TempFile(t, ".", privKey)
fPub, rmPub, _ := test.TempFile(t, ".", pubKey)
fPriv, rmPriv, _ := test.TempFile(".", privKey)
fPub, rmPub, _ := test.TempFile(".", pubKey)
defer rmPriv()
defer rmPub()
@ -163,8 +163,8 @@ func newDnssec(t *testing.T, zones []string) (Dnssec, func(), func()) {
}
func newKey(t *testing.T) (*DNSKEY, func(), func()) {
fPriv, rmPriv, _ := test.TempFile(t, ".", privKey)
fPub, rmPub, _ := test.TempFile(t, ".", pubKey)
fPriv, rmPriv, _ := test.TempFile(".", privKey)
fPub, rmPub, _ := test.TempFile(".", pubKey)
key, err := ParseKeyFile(fPub, fPriv)
if err != nil {