Skip to content

Commit

Permalink
fix: linter error
Browse files Browse the repository at this point in the history
  • Loading branch information
HanHongChen committed Oct 29, 2024
1 parent fbc0841 commit fda81a9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
5 changes: 2 additions & 3 deletions internal/pfcp/handler/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ import (
"regexp"
"testing"

"github.com/free5gc/pfcp"
"github.com/sirupsen/logrus"
. "github.com/smartystreets/goconvey/convey"

"github.com/free5gc/pfcp"
"github.com/free5gc/pfcp/pfcpType"
"github.com/free5gc/pfcp/pfcpUdp"

"github.com/free5gc/smf/internal/logger"
"github.com/free5gc/smf/internal/pfcp/handler"
. "github.com/smartystreets/goconvey/convey"
)

type LogCapture struct {
Expand Down
19 changes: 10 additions & 9 deletions internal/pfcp/message/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"net"
"testing"

"github.com/stretchr/testify/assert"

"github.com/free5gc/pfcp/pfcpType"
"github.com/free5gc/smf/internal/context"
"github.com/free5gc/smf/internal/pfcp/message"
"github.com/free5gc/smf/internal/pfcp/udp"
"github.com/free5gc/smf/pkg/factory"
"github.com/stretchr/testify/assert"
)

var testConfig = factory.Config{
Expand Down Expand Up @@ -42,7 +43,7 @@ func initSmfContext() {
func initRuleList() ([]*context.PDR, []*context.FAR, []*context.BAR,
[]*context.QER, []*context.URR,
) {
var testPDR = &context.PDR{
testPDR := &context.PDR{
PDRID: uint16(1),
State: context.RULE_INITIAL,
OuterHeaderRemoval: &pfcpType.OuterHeaderRemoval{
Expand All @@ -53,7 +54,7 @@ func initRuleList() ([]*context.PDR, []*context.FAR, []*context.BAR,
QER: []*context.QER{},
}

var testFAR = &context.FAR{
testFAR := &context.FAR{
FARID: uint32(123),
// State Can be RULE_INITIAL or RULE_UPDATE or RULE_REMOVE
State: context.RULE_INITIAL,
Expand All @@ -64,19 +65,19 @@ func initRuleList() ([]*context.PDR, []*context.FAR, []*context.BAR,
BAR: &context.BAR{},
}

var testBAR = &context.BAR{
testBAR := &context.BAR{
BARID: uint8(124),
// State Can be RULE_INITIAL or RULE_UPDATE or RULE_REMOVE
State: context.RULE_INITIAL,
}

var testQER = &context.QER{
testQER := &context.QER{
QERID: uint32(123),
// State Can be RULE_INITIAL or RULE_UPDATE or RULE_REMOVE
State: context.RULE_INITIAL,
}

var testURR = &context.URR{
testURR := &context.URR{
URRID: uint32(123),
// State Can be RULE_INITIAL or RULE_UPDATE or RULE_REMOVE
State: context.RULE_INITIAL,
Expand Down Expand Up @@ -154,7 +155,7 @@ func TestBuildPfcpAssociationReleaseResponse(t *testing.T) {

func TestBuildPfcpSessionEstablishmentRequest(t *testing.T) {
initSmfContext()
var smctx = context.NewSMContext("imsi-208930000000001", 10)
smctx := context.NewSMContext("imsi-208930000000001", 10)
pdrList, farList, barList, qerList, urrList := initRuleList()
smctx.PFCPContext["10.4.0.1"] = &context.PFCPSessionContext{}

Expand All @@ -178,7 +179,7 @@ func TestBuildPfcpSessionEstablishmentRequest(t *testing.T) {
assert.Equal(t, urrList[0].State, context.RULE_CREATE)

req2, err2 := message.BuildPfcpSessionEstablishmentRequest(
*testNodeID, "10.4.0.1", smctx, nil, nil, nil, nil, nil)
*testNodeID, "10.4.0.1", smctx, nil, nil, nil, nil, nil)
if err2 != nil {
t.Errorf("TestBuildPfcpSessionEstablishmentRequest failed: %v", err2)
}
Expand Down Expand Up @@ -206,7 +207,7 @@ func TestBuildPfcpSessionEstablishmentResponse(t *testing.T) {

func TestBuildPfcpSessionModificationRequest(t *testing.T) {
initSmfContext()
var smctx = context.NewSMContext("imsi-208930000000001", 10)
smctx := context.NewSMContext("imsi-208930000000001", 10)
pdrList, farList, barList, qerList, urrList := initRuleList()
smctx.PFCPContext["10.4.0.1"] = &context.PFCPSessionContext{}

Expand Down
1 change: 0 additions & 1 deletion internal/pfcp/message/send_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
)

func TestSendPfcpAssociationSetupRequest(t *testing.T) {

}

func TestSendPfcpSessionEstablishmentResponse(t *testing.T) {
Expand Down
9 changes: 5 additions & 4 deletions internal/pfcp/udp/udp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import (
"time"

"github.com/agiledragon/gomonkey"
. "github.com/smartystreets/goconvey/convey"
"github.com/stretchr/testify/require"

"github.com/free5gc/pfcp"
"github.com/free5gc/pfcp/pfcpType"
"github.com/free5gc/pfcp/pfcpUdp"
"github.com/free5gc/smf/internal/context"
smf_pfcp "github.com/free5gc/smf/internal/pfcp"
"github.com/free5gc/smf/internal/pfcp/udp"
"github.com/free5gc/smf/pkg/factory"
. "github.com/smartystreets/goconvey/convey"
"github.com/stretchr/testify/require"
)

const testPfcpClientPort = 12345
Expand Down Expand Up @@ -94,15 +95,15 @@ func initSmfContext() {
}

func TestSendPfcpRequest(t *testing.T) {
//init smf context
// init smf context

Check failure on line 98 in internal/pfcp/udp/udp_test.go

View workflow job for this annotation

GitHub Actions / lint (1.21)

undefined: context.InitSmfContext

Check failure on line 98 in internal/pfcp/udp/udp_test.go

View workflow job for this annotation

GitHub Actions / Go 1.21 sample

undefined: context.InitSmfContext
initSmfContext()
context.GetSelf().CPNodeID = pfcpType.NodeID{
NodeIdType: pfcpType.NodeIdTypeIpv4Address,
IP: net.ParseIP("127.0.0.1").To4(),
}
udp.Server = pfcpUdp.NewPfcpServer(net.ParseIP("127.0.0.1").To4().String())

Check failure on line 104 in internal/pfcp/udp/udp_test.go

View workflow job for this annotation

GitHub Actions / lint (1.21)

undefined: context.GetSelf (typecheck)

Check failure on line 104 in internal/pfcp/udp/udp_test.go

View workflow job for this annotation

GitHub Actions / Go 1.21 sample

undefined: context.GetSelf

//build message
// build message
pfcpMsg := &pfcp.PFCPAssociationSetupRequest{}
message := &pfcp.Message{
Header: pfcp.Header{
Expand Down

0 comments on commit fda81a9

Please sign in to comment.