Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30b76e7
commit 73598c5
Showing
9 changed files
with
153 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package observer | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/letsencrypt/boulder/cmd" | ||
blog "github.com/letsencrypt/boulder/log" | ||
) | ||
|
||
func TestObsConf_ValidateDebugAddr(t *testing.T) { | ||
type fields struct { | ||
DebugAddr string | ||
} | ||
tests := []struct { | ||
name string | ||
fields fields | ||
wantErr bool | ||
}{ | ||
// valid | ||
{"valid", fields{":8080"}, false}, | ||
// invalid | ||
{"out of range high", fields{":65536"}, true}, | ||
{"out of range low", fields{":0"}, true}, | ||
{"not even a port", fields{":foo"}, true}, | ||
{"missing :", fields{"foo"}, true}, | ||
{"missing port", fields{"foo:"}, true}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
c := &ObsConf{ | ||
DebugAddr: tt.fields.DebugAddr, | ||
} | ||
if err := c.ValidateDebugAddr(); (err != nil) != tt.wantErr { | ||
t.Errorf("ObsConf.ValidateDebugAddr() error = %v, wantErr %v", err, tt.wantErr) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func TestObsConf_validate(t *testing.T) { | ||
type fields struct { | ||
Syslog cmd.SyslogConfig | ||
DebugAddr string | ||
MonConfs []*MonConf | ||
} | ||
type args struct { | ||
log blog.Logger | ||
} | ||
tests := []struct { | ||
name string | ||
fields fields | ||
args args | ||
wantErr bool | ||
}{ | ||
// TODO: Add test cases. | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
c := &ObsConf{ | ||
Syslog: tt.fields.Syslog, | ||
DebugAddr: tt.fields.DebugAddr, | ||
MonConfs: tt.fields.MonConfs, | ||
} | ||
if err := c.validate(tt.args.log); (err != nil) != tt.wantErr { | ||
t.Errorf("ObsConf.validate() error = %v, wantErr %v", err, tt.wantErr) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters