Skip to content

Commit

Permalink
Merge 787faf5 into 0c3fc7a
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart committed Dec 3, 2019
2 parents 0c3fc7a + 787faf5 commit 6564153
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion account_claims_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func TestAccountImports(t *testing.T) {
func TestNewNilAccountClaim(t *testing.T) {
v := NewAccountClaims("")
if v != nil {
t.Fatal(fmt.Sprintf("expected nil account claim"))
t.Fatal("expected nil account claim")
}
}

Expand Down
2 changes: 1 addition & 1 deletion activation_claims_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func TestPublicIsNotValid(t *testing.T) {
func TestNilActivationClaim(t *testing.T) {
v := NewActivationClaims("")
if v != nil {
t.Fatal(fmt.Sprintf("expected nil user claim"))
t.Fatal("expected nil activation claim")
}
}

Expand Down
2 changes: 1 addition & 1 deletion cluster_claims_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestClusterSubjects(t *testing.T) {
func TestNewNilClusterClaims(t *testing.T) {
v := NewClusterClaims("")
if v != nil {
t.Fatal(fmt.Sprintf("expected nil user claim"))
t.Fatal("expected nil cluster claim")
}
}

Expand Down
4 changes: 2 additions & 2 deletions exports.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ type ServiceLatency struct {
}

func (sl *ServiceLatency) Validate(vr *ValidationResults) {
if sl.Sampling < 1 || sl.Sampling > 100 {
vr.AddError("sampling percentage needs to be between 1-100")
if sl.Sampling < 0 || sl.Sampling > 100 {
vr.AddError("sampling percentage needs to be between 0-100")
}
sl.Results.Validate(vr)
if sl.Results.HasWildCards() {
Expand Down
18 changes: 13 additions & 5 deletions exports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func TestExportRevocation(t *testing.T) {
e.RevokeAt(pubKey, now.Add(time.Second*1000))

if !e.IsRevoked(pubKey) {
t.Errorf("revocation be true we revoked in the future")
t.Error("revocation be true we revoked in the future")
}
}

Expand All @@ -247,31 +247,39 @@ func TestExportTrackLatency(t *testing.T) {
vr = CreateValidationResults()
e.Validate(vr)
if vr.IsEmpty() {
t.Errorf("adding latency tracking to a stream should have an validation issue")
t.Error("adding latency tracking to a stream should have an validation issue")
}

e = &Export{Subject: "foo", Type: Service}
e.Latency = &ServiceLatency{Sampling: 0, Results: "results"}
vr = CreateValidationResults()
e.Validate(vr)
if !vr.IsEmpty() {
t.Fatal(vr.Issues[0])
}

e = &Export{Subject: "foo", Type: Service}
e.Latency = &ServiceLatency{Sampling: -1, Results: "results"}
vr = CreateValidationResults()
e.Validate(vr)
if vr.IsEmpty() {
t.Errorf("Sampling <1 should have a validation issue")
t.Error("Sampling < 0 should have a validation issue")
}

e = &Export{Subject: "foo", Type: Service}
e.Latency = &ServiceLatency{Sampling: 122, Results: "results"}
vr = CreateValidationResults()
e.Validate(vr)
if vr.IsEmpty() {
t.Errorf("Sampling >100 should have a validation issue")
t.Error("Sampling >100 should have a validation issue")
}

e = &Export{Subject: "foo", Type: Service}
e.Latency = &ServiceLatency{Sampling: 22, Results: "results.*"}
vr = CreateValidationResults()
e.Validate(vr)
if vr.IsEmpty() {
t.Errorf("Results subject needs to be valid publish subject")
t.Error("Results subject needs to be valid publish subject")
}
}

Expand Down
2 changes: 1 addition & 1 deletion header.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

const (
// Version is semantic version.
Version = "0.3.2"
Version = "0.3.4"

// TokenTypeJwt is the JWT token type supported JWT tokens
// encoded and decoded by this library
Expand Down
2 changes: 1 addition & 1 deletion operator_claims_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestInvalidOperatorClaimIssuer(t *testing.T) {
func TestNewNilOperatorClaims(t *testing.T) {
v := NewOperatorClaims("")
if v != nil {
t.Fatal(fmt.Sprintf("expected nil user claim"))
t.Fatal("expected nil operator claim")
}
}

Expand Down
2 changes: 1 addition & 1 deletion server_claims_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestServerSubjects(t *testing.T) {
func TestNewNilServerClaims(t *testing.T) {
v := NewServerClaims("")
if v != nil {
t.Fatal(fmt.Sprintf("expected nil user claim"))
t.Fatal("expected nil server claim")
}
}

Expand Down
2 changes: 1 addition & 1 deletion user_claims_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestUserSubjects(t *testing.T) {
func TestNewNilUserClaim(t *testing.T) {
v := NewUserClaims("")
if v != nil {
t.Fatal(fmt.Sprintf("expected nil user claim"))
t.Fatal("expected nil user claim")
}
}

Expand Down

0 comments on commit 6564153

Please sign in to comment.