Skip to content

Commit

Permalink
fix security alert on golang.org/x/net (#26)
Browse files Browse the repository at this point in the history
* fix security alert on golang.org/x/net
Non-linear parsing of case-insensitive content in golang.org/x/net/html

* adding +build integration for nats and redis testing

* fix unit test error
  • Loading branch information
eddieraa authored Dec 19, 2024
1 parent 35821fc commit 04b57a4
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/nats-io/nuid v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.28.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
3 changes: 3 additions & 0 deletions nats/nats_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build integration
// +build integration

package nats

import (
Expand Down
3 changes: 3 additions & 0 deletions redis/redis_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build integration
// +build integration

package redis

import (
Expand Down
15 changes: 11 additions & 4 deletions registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ func TestChainFilter(t *testing.T) {
logrus.Info("\n", chainFilters(pongs, f), "\n", chainFilters(pongs, f), "\n", chainFilters(pongs, f), "\n", chainFilters(pongs, f))

}

func launchSubscriber(chstop chan interface{}, name string, addr string, kv ...string) {
func launchSubscriber3(chstop chan interface{}, chend chan interface{}, name string, addr string, kv ...string) {
reg, _ := NewRegistry(WithPubsub(pb), WithRegisterInterval(500*time.Millisecond))
myaddr := addr
host := ""
Expand All @@ -104,6 +103,13 @@ func launchSubscriber(chstop chan interface{}, name string, addr string, kv ...s
fn()
}
reg.Close()
close(chend)
}

func launchSubscriber(chstop chan interface{}, name string, addr string, kv ...string) {
chend := make(chan interface{})
launchSubscriber3(chstop, chend, name, addr, kv...)
<-chend
}

func TestRegWithDefaultInstance(t *testing.T) {
Expand Down Expand Up @@ -646,14 +652,15 @@ func TestGetServiceWithFilter(t *testing.T) {
ch := make(chan interface{})
r, _ := NewRegistry(WithPubsub(pb), WithTimeout(time.Millisecond*200))
serviceName := "TestGetServiceWithFilter"
go launchSubscriber(ch, serviceName, "999", "node", "primary")
chend := make(chan interface{})
go launchSubscriber3(ch, chend, serviceName, "999", "node", "primary")
assert.NotNil(t, r)
s, err := r.GetService(serviceName)
assert.Nil(t, err)
assert.NotNil(t, s)
//close chanel trigger unsubscribe
close(ch)
time.Sleep(time.Millisecond * 30)
<-chend
s, err = r.GetService(serviceName)
assert.NotNil(t, err)
assert.Nil(t, s)
Expand Down
3 changes: 3 additions & 0 deletions samples/test_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build integration
// +build integration

package main

import (
Expand Down
4 changes: 2 additions & 2 deletions test/fakepubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ func (s *fakeServer) SendMessage(mes *pubsub.PubsubMsg) error {

if subs, ok := m[mes.Subject]; ok {
for _, v := range subs {
go v(mes)
v(mes)
}
} else {
//subject is unknown
s.fakecli.Sub(mes.Subject, fakesub)
m = s.getCachesub()
if subs, ok = m[mes.Subject]; ok {
for _, v := range subs {
go v(mes)
v(mes)
}
}
}
Expand Down

0 comments on commit 04b57a4

Please sign in to comment.