refactor: nettests is now an internal package (#165)
I'm moving everything into internal packages since this ain't a library. While there, remove typo that was causing a build breakage.
This commit is contained in:
parent
fb2ca32004
commit
a58dff3050
15 changed files with 2 additions and 3 deletions
|
|
@ -1,59 +0,0 @@
|
|||
package nettests
|
||||
|
||||
// WhatsApp test implementation
|
||||
type WhatsApp struct {
|
||||
}
|
||||
|
||||
// Run starts the test
|
||||
func (h WhatsApp) Run(ctl *Controller) error {
|
||||
builder, err := ctl.Session.NewExperimentBuilder(
|
||||
"whatsapp",
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ctl.Run(builder, []string{""})
|
||||
}
|
||||
|
||||
// WhatsAppTestKeys for the test
|
||||
type WhatsAppTestKeys struct {
|
||||
RegistrationServerBlocking bool `json:"registration_server_blocking"`
|
||||
WebBlocking bool `json:"whatsapp_web_blocking"`
|
||||
EndpointsBlocking bool `json:"whatsapp_endpoints_blocking"`
|
||||
IsAnomaly bool `json:"-"`
|
||||
}
|
||||
|
||||
// GetTestKeys generates a summary for a test run
|
||||
func (h WhatsApp) GetTestKeys(tk map[string]interface{}) (interface{}, error) {
|
||||
var (
|
||||
webBlocking bool
|
||||
registrationBlocking bool
|
||||
endpointsBlocking bool
|
||||
)
|
||||
|
||||
var computeBlocking = func(key string) bool {
|
||||
const blk = "blocked"
|
||||
if tk[key] == nil {
|
||||
return false
|
||||
}
|
||||
if tk[key].(string) == blk {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
registrationBlocking = computeBlocking("registration_server_status")
|
||||
webBlocking = computeBlocking("whatsapp_web_status")
|
||||
endpointsBlocking = computeBlocking("whatsapp_endpoints_status")
|
||||
|
||||
return WhatsAppTestKeys{
|
||||
RegistrationServerBlocking: registrationBlocking,
|
||||
WebBlocking: webBlocking,
|
||||
EndpointsBlocking: endpointsBlocking,
|
||||
IsAnomaly: registrationBlocking || webBlocking || endpointsBlocking,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// LogSummary writes the summary to the standard output
|
||||
func (h WhatsApp) LogSummary(s string) error {
|
||||
return nil
|
||||
}
|
||||
Loading…
Reference in a new issue