mirror of https://github.com/status-im/consul.git
Adds a unit test to make sure the status endpoint doesn't ever show anything
with "token" in the name.
This commit is contained in:
parent
d51303b998
commit
34da7ccd64
|
@ -1,6 +1,7 @@
|
||||||
package agent
|
package agent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
@ -117,6 +118,15 @@ func TestHTTPAgentSelf(t *testing.T) {
|
||||||
if val.Coord != nil {
|
if val.Coord != nil {
|
||||||
t.Fatalf("should have been nil: %v", val.Coord)
|
t.Fatalf("should have been nil: %v", val.Coord)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure there's nothing called "token" that's leaked.
|
||||||
|
raw, err := srv.marshalJSON(req, obj)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("err: %v", err)
|
||||||
|
}
|
||||||
|
if bytes.Contains(bytes.ToLower(raw), []byte("token")) {
|
||||||
|
t.Fatalf("bad: %s", raw)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHTTPAgentReload(t *testing.T) {
|
func TestHTTPAgentReload(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue