Skip to content

Commit

Permalink
fix: metric naming and test case (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
sysulq authored Sep 27, 2022
1 parent d564749 commit e55e36a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions pkg/sentinel/sentinel_circuitbreaker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var _ = ginkgo.Describe("sentinel unit test with config", func() {

pass := false
for _, s := range ss {
if s.GetName() == "jupiter_sentinel_request" {
if s.GetName() == "sentinel_request" {
m := s.GetMetric()[0]
Expect(m.GetCounter().GetValue()).Should(BeEquivalentTo(1))
pass = true
Expand Down Expand Up @@ -102,7 +102,7 @@ var _ = ginkgo.Describe("sentinel unit test with config", func() {
pass := false

for _, s := range ss {
if s.GetName() == "jupiter_sentinel_exceptions_thrown" {
if s.GetName() == "sentinel_exceptions_thrown" {
m := s.GetMetric()[0]
Expect(m.Counter.GetValue()).Should(BeEquivalentTo(100))
pass = true
Expand Down Expand Up @@ -130,7 +130,7 @@ var _ = ginkgo.Describe("sentinel unit test with config", func() {
pass := false

for _, s := range ss {
if s.GetName() == "jupiter_sentinel_rt" {
if s.GetName() == "sentinel_rt" {
m := s.GetMetric()[0]

Expect(m.Histogram.GetSampleCount()).Should(BeEquivalentTo(1))
Expand Down Expand Up @@ -177,20 +177,20 @@ var _ = ginkgo.Describe("sentinel unit test with config", func() {

var pass1, pass2, pass3 bool
for _, s := range ss {
if s.GetName() == "jupiter_sentinel_rt" {
if s.GetName() == "sentinel_rt" {
m := s.GetMetric()[0]
Expect(m.Histogram.GetSampleCount()).Should(BeEquivalentTo(4))
pass1 = true
}

if s.GetName() == "jupiter_sentinel_request" {
if s.GetName() == "sentinel_request" {
m := s.GetMetric()[0]
fmt.Println(m.GetLabel()[1].GetValue(), "!!!!!", m.GetLabel()[2].GetValue())
Expect(m.Counter.GetValue()).Should(BeEquivalentTo(5))
pass2 = true
}

if s.GetName() == "jupiter_sentinel_state" {
if s.GetName() == "sentinel_state" {
m := s.GetMetric()[0]
fmt.Println(m)

Expand Down Expand Up @@ -231,7 +231,7 @@ var _ = ginkgo.Describe("sentinel unit test with config", func() {

haveMetric := false
for _, s := range ss {
if s.GetName() == "jupiter_sentinel_request" {
if s.GetName() == "sentinel_request" {
m := s.GetMetric()[0]
Expect(m.GetCounter().GetValue()).Should(BeEquivalentTo(1))
haveMetric = true
Expand Down
4 changes: 2 additions & 2 deletions pkg/xlog/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func Test_log(t *testing.T) {
found := false
for _, v := range data {

if v.GetName() == "jupiter_log_level_total" {
if v.GetName() == "log_level_total" {
assert.NotEmpty(t, v.GetMetric())
found = true

Expand Down Expand Up @@ -74,7 +74,7 @@ func Test_trace(t *testing.T) {
found := false
for _, v := range data {

if v.GetName() == "jupiter_log_level_total" {
if v.GetName() == "log_level_total" {
assert.NotEmpty(t, v.GetMetric())
found = true

Expand Down

0 comments on commit e55e36a

Please sign in to comment.