modify project name
This commit is contained in:
@@ -11,10 +11,10 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/mayswind/lab/pkg/errs"
|
||||
"github.com/mayswind/lab/pkg/log"
|
||||
"github.com/mayswind/lab/pkg/settings"
|
||||
"github.com/mayswind/lab/pkg/utils"
|
||||
"github.com/mayswind/ezbookkeeping/pkg/errs"
|
||||
"github.com/mayswind/ezbookkeeping/pkg/log"
|
||||
"github.com/mayswind/ezbookkeeping/pkg/settings"
|
||||
"github.com/mayswind/ezbookkeeping/pkg/utils"
|
||||
)
|
||||
|
||||
// Length and mask of all information in request id
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/mayswind/lab/pkg/settings"
|
||||
"github.com/mayswind/ezbookkeeping/pkg/settings"
|
||||
)
|
||||
|
||||
func TestNewDefaultRequestIdGenerator_Http(t *testing.T) {
|
||||
@@ -23,7 +23,7 @@ func TestNewDefaultRequestIdGenerator_Http(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewDefaultRequestIdGenerator_UnixSocket(t *testing.T) {
|
||||
generator, _ := NewDefaultRequestIdGenerator(&settings.Config{HttpAddr: "1.2.3.4", UnixSocketPath: "/var/lib/labapp/lab.sock", Protocol: "socket", SecretKey: "secretkey"})
|
||||
generator, _ := NewDefaultRequestIdGenerator(&settings.Config{HttpAddr: "1.2.3.4", UnixSocketPath: "/var/lib/ezbookkeeping/ezbookkeeping.sock", Protocol: "socket", SecretKey: "secretkey"})
|
||||
requestId := generator.GenerateRequestId("127.0.0.1")
|
||||
requestIdInfo := generator.parseRequestIdInfo(generator.parseRequestIdFromUuid(requestId))
|
||||
|
||||
@@ -31,13 +31,13 @@ func TestNewDefaultRequestIdGenerator_UnixSocket(t *testing.T) {
|
||||
actualServerUniqId := requestIdInfo.ServerUniqId
|
||||
assert.Equal(t, expectedServerUniqId, actualServerUniqId)
|
||||
|
||||
expectedInstanceUniqId := uint16(0x694b) // crc32("/var/lib/labapp/lab.sock" + "_" + "secretkey") & 0xFFFF
|
||||
expectedInstanceUniqId := uint16(0x2cc) // crc32("/var/lib/ezbookkeeping/ezbookkeeping.sock" + "_" + "secretkey") & 0xFFFF
|
||||
actualInstanceUniqId := requestIdInfo.InstanceUniqId
|
||||
assert.Equal(t, expectedInstanceUniqId, actualInstanceUniqId)
|
||||
}
|
||||
|
||||
func TestNewDefaultRequestIdGenerator_ClientIpv4(t *testing.T) {
|
||||
generator, _ := NewDefaultRequestIdGenerator(&settings.Config{HttpAddr: "1.2.3.4", UnixSocketPath: "/var/lib/labapp/lab.sock", Protocol: "socket", SecretKey: "secretkey"})
|
||||
generator, _ := NewDefaultRequestIdGenerator(&settings.Config{HttpAddr: "1.2.3.4", UnixSocketPath: "/var/lib/ezbookkeeping/ezbookkeeping.sock", Protocol: "socket", SecretKey: "secretkey"})
|
||||
requestId := generator.GenerateRequestId("127.0.0.1")
|
||||
requestIdInfo := generator.parseRequestIdInfo(generator.parseRequestIdFromUuid(requestId))
|
||||
|
||||
@@ -62,7 +62,7 @@ func TestNewDefaultRequestIdGenerator_ClientIpv4(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewDefaultRequestIdGenerator_ClientIpv6(t *testing.T) {
|
||||
generator, _ := NewDefaultRequestIdGenerator(&settings.Config{HttpAddr: "1.2.3.4", UnixSocketPath: "/var/lib/labapp/lab.sock", Protocol: "socket", SecretKey: "secretkey"})
|
||||
generator, _ := NewDefaultRequestIdGenerator(&settings.Config{HttpAddr: "1.2.3.4", UnixSocketPath: "/var/lib/ezbookkeeping/ezbookkeeping.sock", Protocol: "socket", SecretKey: "secretkey"})
|
||||
requestId := generator.GenerateRequestId("2001:abc:def:1234::1")
|
||||
requestIdInfo := generator.parseRequestIdInfo(generator.parseRequestIdFromUuid(requestId))
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package requestid
|
||||
|
||||
import (
|
||||
"github.com/mayswind/lab/pkg/settings"
|
||||
"github.com/mayswind/ezbookkeeping/pkg/settings"
|
||||
)
|
||||
|
||||
// RequestIdContainer contains the current request id generator
|
||||
|
||||
Reference in New Issue
Block a user