feat(clients/go): mxgw-go -require-certificate-validation flag (mxaccessgw#199)
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"net"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -859,3 +860,24 @@ func TestRunStreamEventsPrintsReplayGap(t *testing.T) {
|
||||
t.Fatalf("stream-events -json gap cursors must be JSON numbers, got: %s", lines[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestRequireCertificateValidationFlag(t *testing.T) {
|
||||
parse := func(args ...string) commonOptions {
|
||||
flags := flag.NewFlagSet("t", flag.ContinueOnError)
|
||||
common := bindCommonFlags(flags)
|
||||
if err := flags.Parse(args); err != nil {
|
||||
t.Fatalf("parse: %v", err)
|
||||
}
|
||||
resolved, err := common.resolved()
|
||||
if err != nil {
|
||||
t.Fatalf("resolved: %v", err)
|
||||
}
|
||||
return resolved
|
||||
}
|
||||
if parse().RequireCertificateValidation {
|
||||
t.Fatal("default must stay lenient")
|
||||
}
|
||||
if !parse("-require-certificate-validation").RequireCertificateValidation {
|
||||
t.Fatal("flag must set RequireCertificateValidation")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user