From c6e8cd2a130d0eb73a49fed3dda6ea26e9819ea2 Mon Sep 17 00:00:00 2001 From: The Things Bot Date: Fri, 18 Aug 2023 12:53:48 +0000 Subject: [PATCH 1/6] all: Cut off changelog version 3.27.1 --- CHANGELOG.md | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 621cc22051..9e2bacb618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,11 +11,6 @@ For details about compatibility between different releases, see the **Commitment ### Added -- Add support for `administrative_contact` and `technical_contact` in the Console. -- Reimplement move away prompt in payload formatter views in the Console. -- Add telemetry collection for the CLI. A background process was added to the CLI in order to send the following information: Operating System, Architecture, Binary version and Golang version. The message is sent every 24 hours and it contains an unique random number as an identifier. It is enabled by default and in order to disable it, set `telemetry.enable` to false in the CLI configuration. For more information, consult the documentation [here](https://www.thethingsindustries.com/docs/reference/telemetry/cli). -- Add telemetry collection for the IdentityServer. A background task was added in the Identity Server which is responsible for collecting information regarding the amount of each entity in the database, this has the purpose of allowing us to better understand how users are interacting with the system, an example being if tenants are using Organizations or just Users. All information is sent every 24 hours and it contains an identifier composed of the URLs present in the following configuration fields `console.ui.[is|gs|ns|as|js].base-url`. It is enabled by default and in order to disable it, set `telemetry.enable` to false in the Stack configuration. For more information, consult the documentation [here](https://www.thethingsindustries.com/docs/reference/telemetry/identity_server). - ### Changed ### Deprecated @@ -24,13 +19,24 @@ For details about compatibility between different releases, see the **Commitment ### Fixed +### Security + +## [3.27.1] - unreleased + +### Added + +- Add support for `administrative_contact` and `technical_contact` in the Console. +- Reimplement move away prompt in payload formatter views in the Console. +- Add telemetry collection for the CLI. A background process was added to the CLI in order to send the following information: Operating System, Architecture, Binary version and Golang version. The message is sent every 24 hours and it contains an unique random number as an identifier. It is enabled by default and in order to disable it, set `telemetry.enable` to false in the CLI configuration. For more information, consult the documentation [here](https://www.thethingsindustries.com/docs/reference/telemetry/cli). +- Add telemetry collection for the IdentityServer. A background task was added in the Identity Server which is responsible for collecting information regarding the amount of each entity in the database, this has the purpose of allowing us to better understand how users are interacting with the system, an example being if tenants are using Organizations or just Users. All information is sent every 24 hours and it contains an identifier composed of the URLs present in the following configuration fields `console.ui.[is|gs|ns|as|js].base-url`. It is enabled by default and in order to disable it, set `telemetry.enable` to false in the Stack configuration. For more information, consult the documentation [here](https://www.thethingsindustries.com/docs/reference/telemetry/identity_server). + +### Fixed + - OAuth clients created by an admin no longer trigger an email requesting approval from one of the tenant's admins. - Broken network routing policy links in the Packet Broker panel of the admin panel in the Console. - Application Server downlink related events now contain the complete set of end device identifiers, and the received at timestamp is now provided at all times. - Wrong order of breadcrumbs in the device views of the Console. -### Security - ## [3.27.0] - 2023-07-31 ### Added @@ -2657,7 +2663,8 @@ For details about compatibility between different releases, see the **Commitment NOTE: These links should respect backports. See https://github.com/TheThingsNetwork/lorawan-stack/pull/1444/files#r333379706. --> -[unreleased]: https://github.com/TheThingsNetwork/lorawan-stack/compare/v3.27.0...v3.27 +[unreleased]: https://github.com/TheThingsNetwork/lorawan-stack/compare/v3.27.1...v3.27 +[3.27.1]: https://github.com/TheThingsNetwork/lorawan-stack/compare/v3.27.0...v3.27.1 [3.27.0]: https://github.com/TheThingsNetwork/lorawan-stack/compare/v3.26.2...v3.27.0 [3.26.2]: https://github.com/TheThingsNetwork/lorawan-stack/compare/v3.26.1...v3.26.2 [3.26.1]: https://github.com/TheThingsNetwork/lorawan-stack/compare/v3.26.0...v3.26.1 From 770a0c95493359dadf7a3891b41969b0223ff911 Mon Sep 17 00:00:00 2001 From: Adrian-Stefan Mares Date: Fri, 18 Aug 2023 15:12:21 +0200 Subject: [PATCH 2/6] all: Fix telemetry test race --- pkg/telemetry/exporter/task_queue_test.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/telemetry/exporter/task_queue_test.go b/pkg/telemetry/exporter/task_queue_test.go index 4eef70fc1a..515fef7c6d 100644 --- a/pkg/telemetry/exporter/task_queue_test.go +++ b/pkg/telemetry/exporter/task_queue_test.go @@ -19,6 +19,7 @@ import ( "fmt" "os" "sync" + "sync/atomic" "testing" "time" @@ -94,11 +95,11 @@ func TestTaskWrappers(t *testing.T) { }) } -// TestConcurentTaskSet adds two distinct tasks within the task queue in order to test the all of its operations. +// TestConcurrentTaskSet adds two distinct tasks within the task queue in order to test the all of its operations. // // Involves in creating the dispatch loop, adding tasks, registering callback, popping tasks and validating the amount // of times the callback have been called. -func TestConcurentTaskSet(t *testing.T) { +func TestConcurrentTaskSet(t *testing.T) { t.Parallel() a, ctx := test.New(t) @@ -123,16 +124,16 @@ func TestConcurentTaskSet(t *testing.T) { a.So(tq.Add(ctx, "test_task_1", time.Now().Add(callbackDelay), false), should.BeNil) a.So(tq.Add(ctx, "test_task_2", time.Now().Add(callbackDelay), false), should.BeNil) - cntA := 0 - cntB := 0 + cntA := int64(0) + cntB := int64(0) // Register callbacks. tq.RegisterCallback("test_task_1", func(ctx context.Context) (time.Time, error) { - cntA++ + atomic.AddInt64(&cntA, 1) return time.Now().Add(callbackDelay), nil }) tq.RegisterCallback("test_task_2", func(ctx context.Context) (time.Time, error) { - cntB++ + atomic.AddInt64(&cntB, 1) return time.Now().Add(callbackDelay), nil }) @@ -186,7 +187,7 @@ func TestConcurentTaskSet(t *testing.T) { // Considering the delay within interacting with redis, it is still expected to have at least 5 calls to each // callback. // - a.So(cntA, should.BeGreaterThanOrEqualTo, 5) - a.So(cntB, should.BeGreaterThanOrEqualTo, 5) + a.So(atomic.LoadInt64(&cntA), should.BeGreaterThanOrEqualTo, 5) + a.So(atomic.LoadInt64(&cntB), should.BeGreaterThanOrEqualTo, 5) } } From b0fb466ac5064bce7a5817142209a75f772f801a Mon Sep 17 00:00:00 2001 From: Adrian-Stefan Mares Date: Fri, 18 Aug 2023 15:22:26 +0200 Subject: [PATCH 3/6] all: Do not use fixed gRPC ports in tests --- .../applicationserver_test.go | 6 +-- .../io/pubsub/integrate_test.go | 2 +- pkg/gatewayserver/gatewayserver_test.go | 43 ++++--------------- 3 files changed, 12 insertions(+), 39 deletions(-) diff --git a/pkg/applicationserver/applicationserver_test.go b/pkg/applicationserver/applicationserver_test.go index 23f6883324..83dda21cd8 100644 --- a/pkg/applicationserver/applicationserver_test.go +++ b/pkg/applicationserver/applicationserver_test.go @@ -266,7 +266,7 @@ func TestApplicationServer(t *testing.T) { c := componenttest.NewComponent(t, &component.Config{ ServiceBase: config.ServiceBase{ GRPC: config.GRPC{ - Listen: ":9184", + Listen: ":0", AllowInsecureForCredentials: true, }, HTTP: config.HTTP{ @@ -2905,7 +2905,7 @@ func TestLocationFromPayload(t *testing.T) { c := componenttest.NewComponent(t, &component.Config{ ServiceBase: config.ServiceBase{ GRPC: config.GRPC{ - Listen: ":9189", + Listen: ":0", AllowInsecureForCredentials: true, }, Cluster: cluster.Config{ @@ -3093,7 +3093,7 @@ func TestUplinkNormalized(t *testing.T) { c := componenttest.NewComponent(t, &component.Config{ ServiceBase: config.ServiceBase{ GRPC: config.GRPC{ - Listen: ":9189", + Listen: ":0", AllowInsecureForCredentials: true, }, Cluster: cluster.Config{ diff --git a/pkg/applicationserver/io/pubsub/integrate_test.go b/pkg/applicationserver/io/pubsub/integrate_test.go index 6008523240..83107ac37f 100644 --- a/pkg/applicationserver/io/pubsub/integrate_test.go +++ b/pkg/applicationserver/io/pubsub/integrate_test.go @@ -93,7 +93,7 @@ func TestIntegrate(t *testing.T) { c := componenttest.NewComponent(t, &component.Config{ ServiceBase: config.ServiceBase{ GRPC: config.GRPC{ - Listen: ":9185", + Listen: ":0", AllowInsecureForCredentials: true, }, Cluster: cluster.Config{ diff --git a/pkg/gatewayserver/gatewayserver_test.go b/pkg/gatewayserver/gatewayserver_test.go index 8659930fc9..e3f48ef4ea 100644 --- a/pkg/gatewayserver/gatewayserver_test.go +++ b/pkg/gatewayserver/gatewayserver_test.go @@ -46,7 +46,6 @@ import ( gsredis "go.thethings.network/lorawan-stack/v3/pkg/gatewayserver/redis" "go.thethings.network/lorawan-stack/v3/pkg/gatewayserver/upstream/mock" mockis "go.thethings.network/lorawan-stack/v3/pkg/identityserver/mock" - "go.thethings.network/lorawan-stack/v3/pkg/rpcclient" "go.thethings.network/lorawan-stack/v3/pkg/rpcmetadata" "go.thethings.network/lorawan-stack/v3/pkg/ttnpb" encoding "go.thethings.network/lorawan-stack/v3/pkg/ttnpb/udp" @@ -87,7 +86,7 @@ func TestGatewayServer(t *testing.T) { c := componenttest.NewComponent(t, &component.Config{ ServiceBase: config.ServiceBase{ GRPC: config.GRPC{ - Listen: ":9187", + Listen: ":0", AllowInsecureForCredentials: true, }, Cluster: cluster.Config{ @@ -225,18 +224,13 @@ func TestGatewayServer(t *testing.T) { return ids.GatewayId == registeredGatewayID && key == registeredGatewayKey }, Link: func(ctx context.Context, t *testing.T, ids *ttnpb.GatewayIdentifiers, key string, upCh <-chan *ttnpb.GatewayUp, downCh chan<- *ttnpb.GatewayDown) error { - conn, err := grpc.Dial(":9187", append(rpcclient.DefaultDialOptions(ctx), grpc.WithInsecure(), grpc.WithBlock())...) - if err != nil { - return err - } - defer conn.Close() md := rpcmetadata.MD{ ID: ids.GatewayId, AuthType: "Bearer", AuthValue: key, AllowInsecure: true, } - client := ttnpb.NewGtwGsClient(conn) + client := ttnpb.NewGtwGsClient(gs.LoopbackConn()) _, err = client.GetConcentratorConfig(ctx, ttnpb.Empty, grpc.PerRPCCredentials(md)) if err != nil { return err @@ -749,16 +743,11 @@ func TestGatewayServer(t *testing.T) { } // Setup a stats client with independent context to query whether the gateway is connected and statistics on // upstream and downstream. - statsConn, err := grpc.Dial(":9187", append(rpcclient.DefaultDialOptions(test.Context()), grpc.WithInsecure(), grpc.WithBlock())...) - if !a.So(err, should.BeNil) { - t.FailNow() - } - defer statsConn.Close() statsCtx := metadata.AppendToOutgoingContext(test.Context(), "id", ids.GatewayId, "authorization", fmt.Sprintf("Bearer %v", registeredGatewayKey), ) - statsClient := ttnpb.NewGsClient(statsConn) + statsClient := ttnpb.NewGsClient(gs.LoopbackConn()) // The gateway should not be connected before testing traffic. t.Run("NotConnected", func(t *testing.T) { @@ -1842,18 +1831,13 @@ func TestGatewayServer(t *testing.T) { Eui: registeredGatewayEUI.Bytes(), } - conn, err := grpc.Dial(":9187", append(rpcclient.DefaultDialOptions(ctx), grpc.WithInsecure(), grpc.WithBlock())...) - if !a.So(err, should.BeNil) { - t.FailNow() - } - defer conn.Close() md := rpcmetadata.MD{ ID: ids.GatewayId, AuthType: "Bearer", AuthValue: registeredGatewayKey, AllowInsecure: true, } - _, err = ttnpb.NewGtwGsClient(conn).LinkGateway(ctx, grpc.PerRPCCredentials(md)) + _, err = ttnpb.NewGtwGsClient(gs.LoopbackConn()).LinkGateway(ctx, grpc.PerRPCCredentials(md)) if !a.So(err, should.BeNil) { t.FailNow() } @@ -1884,7 +1868,7 @@ func TestUpdateVersionInfo(t *testing.T) { //nolint:paralleltest c := componenttest.NewComponent(t, &component.Config{ ServiceBase: config.ServiceBase{ GRPC: config.GRPC{ - Listen: ":9187", + Listen: ":0", AllowInsecureForCredentials: true, }, Cluster: cluster.Config{ @@ -2028,16 +2012,11 @@ func TestUpdateVersionInfo(t *testing.T) { //nolint:paralleltest // Test Disconnection on delete. // Setup a stats client with independent context to query whether the gateway is connected and statistics on // upstream and downstream. - statsConn, err := grpc.Dial(":9187", append(rpcclient.DefaultDialOptions(test.Context()), grpc.WithInsecure(), grpc.WithBlock())...) - if !a.So(err, should.BeNil) { - t.FailNow() - } - defer statsConn.Close() statsCtx := metadata.AppendToOutgoingContext(test.Context(), "id", ids.GatewayId, "authorization", fmt.Sprintf("Bearer %v", registeredGatewayKey), ) - statsClient := ttnpb.NewGsClient(statsConn) + statsClient := ttnpb.NewGsClient(gs.LoopbackConn()) stat, err := statsClient.GetGatewayConnectionStats(statsCtx, gtwIDs) a.So(err, should.BeNil) @@ -2081,7 +2060,7 @@ func TestBatchGetStatus(t *testing.T) { c := componenttest.NewComponent(t, &component.Config{ ServiceBase: config.ServiceBase{ GRPC: config.GRPC{ - Listen: ":9187", + Listen: ":0", AllowInsecureForCredentials: true, }, Cluster: cluster.Config{ @@ -2189,13 +2168,7 @@ func TestBatchGetStatus(t *testing.T) { GatewayId: "eui-aaee000000000001", } - statsConn, err := grpc.Dial(":9187", - append(rpcclient.DefaultDialOptions(test.Context()), grpc.WithInsecure(), grpc.WithBlock())...) - if !a.So(err, should.BeNil) { - t.FailNow() - } - defer statsConn.Close() - statsClient := ttnpb.NewGsClient(statsConn) + statsClient := ttnpb.NewGsClient(gs.LoopbackConn()) statsCtx := metadata.AppendToOutgoingContext(test.Context(), "id", gtwIDs1.GatewayId, "authorization", fmt.Sprintf("Bearer %v", registeredGatewayKey), From 4c394d02e0700ef446021d40101a500ed7e9c4eb Mon Sep 17 00:00:00 2001 From: Adrian-Stefan Mares Date: Fri, 18 Aug 2023 15:34:29 +0200 Subject: [PATCH 4/6] as: Do not use fixed HTTP ports in tests --- .../applicationserver_test.go | 24 +++++-------------- pkg/applicationserver/io/web/webhooks_test.go | 22 ++++++----------- 2 files changed, 13 insertions(+), 33 deletions(-) diff --git a/pkg/applicationserver/applicationserver_test.go b/pkg/applicationserver/applicationserver_test.go index 83dda21cd8..0c37b39110 100644 --- a/pkg/applicationserver/applicationserver_test.go +++ b/pkg/applicationserver/applicationserver_test.go @@ -269,9 +269,6 @@ func TestApplicationServer(t *testing.T) { Listen: ":0", AllowInsecureForCredentials: true, }, - HTTP: config.HTTP{ - Listen: ":8099", - }, Cluster: cluster.Config{ IdentityServer: isAddr, JoinServer: jsAddr, @@ -833,19 +830,16 @@ func TestApplicationServer(t *testing.T) { chs.downErr <- err continue } - url := fmt.Sprintf("http://127.0.0.1:8099/api/v3/as/applications/%s/webhooks/%s/devices/%s/down/%s", + url := fmt.Sprintf("/api/v3/as/applications/%s/webhooks/%s/devices/%s/down/%s", data.EndDeviceIds.ApplicationIds.ApplicationId, registeredApplicationWebhookID.WebhookId, data.EndDeviceIds.DeviceId, action, ) - req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(buf)) - if err != nil { - chs.downErr <- err - continue - } + req := httptest.NewRequest(http.MethodPost, url, bytes.NewReader(buf)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", key)) - res, err := http.DefaultClient.Do(req) - if err == nil && (res.StatusCode < 200 || res.StatusCode > 299) { - err = errors.FromHTTPStatusCode(res.StatusCode) + res := httptest.NewRecorder() + c.ServeHTTP(res, req) + if res.Code < 200 || res.Code > 299 { + err = errors.FromHTTPStatusCode(res.Code) } chs.downErr <- err } @@ -2911,9 +2905,6 @@ func TestLocationFromPayload(t *testing.T) { Cluster: cluster.Config{ IdentityServer: isAddr, }, - HTTP: config.HTTP{ - Listen: ":8100", - }, }, }) config := &applicationserver.Config{ @@ -3099,9 +3090,6 @@ func TestUplinkNormalized(t *testing.T) { Cluster: cluster.Config{ IdentityServer: isAddr, }, - HTTP: config.HTTP{ - Listen: ":8100", - }, }, }) config := &applicationserver.Config{ diff --git a/pkg/applicationserver/io/web/webhooks_test.go b/pkg/applicationserver/io/web/webhooks_test.go index 19be11483a..bb591cd8d0 100644 --- a/pkg/applicationserver/io/web/webhooks_test.go +++ b/pkg/applicationserver/io/web/webhooks_test.go @@ -20,6 +20,7 @@ import ( "fmt" stdio "io" "net/http" + "net/http/httptest" "testing" "time" @@ -498,7 +499,6 @@ func TestWebhooks(t *testing.T) { ttnpb.Right_RIGHT_APPLICATION_DEVICES_WRITE, ttnpb.Right_RIGHT_APPLICATION_TRAFFIC_READ, ttnpb.Right_RIGHT_APPLICATION_TRAFFIC_DOWN_WRITE) - httpAddress := "0.0.0.0:8098" conf := &component.Config{ ServiceBase: config.ServiceBase{ GRPC: config.GRPC{ @@ -508,9 +508,6 @@ func TestWebhooks(t *testing.T) { Cluster: cluster.Config{ IdentityServer: isAddr, }, - HTTP: config.HTTP{ - Listen: httpAddress, - }, }, } c := componenttest.NewComponent(t, conf) @@ -555,21 +552,16 @@ func TestWebhooks(t *testing.T) { } { t.Run(tc.Name, func(t *testing.T) { a := assertions.New(t) - url := fmt.Sprintf("http://%s/api/v3/as/applications/%s/webhooks/%s/devices/%s/down/replace", - httpAddress, tc.ID.ApplicationId, registeredWebhookID, registeredDeviceID.DeviceId, + url := fmt.Sprintf("/api/v3/as/applications/%s/webhooks/%s/devices/%s/down/replace", + tc.ID.ApplicationId, registeredWebhookID, registeredDeviceID.DeviceId, ) body := bytes.NewReader([]byte(`{"downlinks":[]}`)) - req, err := http.NewRequest(http.MethodPost, url, body) - if !a.So(err, should.BeNil) { - t.FailNow() - } + req := httptest.NewRequest(http.MethodPost, url, body) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", tc.Key)) - res, err := http.DefaultClient.Do(req) - if !a.So(err, should.BeNil) { - t.FailNow() - } - a.So(res.StatusCode, should.Equal, tc.ExpectCode) + res := httptest.NewRecorder() + c.ServeHTTP(res, req) + a.So(res.Code, should.Equal, tc.ExpectCode) downlinks, err := io.DownlinkQueueList(ctx, registeredDeviceID) if !a.So(err, should.BeNil) { t.FailNow() From b587a82ff60272eaba2b1945a561fbc67379cac6 Mon Sep 17 00:00:00 2001 From: Adrian-Stefan Mares Date: Fri, 18 Aug 2023 16:22:26 +0200 Subject: [PATCH 5/6] all: Update golang.org/x/exp --- go.mod | 2 +- go.sum | 4 ++-- pkg/band/band_test.go | 8 ++++---- pkg/band/channel_mask.go | 4 ++-- tools/go.mod | 6 +++--- tools/go.sum | 12 ++++++------ 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 581034a6c5..cb1e7c4b1d 100644 --- a/go.mod +++ b/go.mod @@ -99,7 +99,7 @@ require ( gocloud.dev v0.33.0 gocloud.dev/pubsub/natspubsub v0.33.0 golang.org/x/crypto v0.12.0 - golang.org/x/exp v0.0.0-20230321023759-10a507213a29 + golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 golang.org/x/net v0.14.0 golang.org/x/oauth2 v0.10.0 golang.org/x/sync v0.3.0 diff --git a/go.sum b/go.sum index 5f2d1baea9..27f6b3c759 100644 --- a/go.sum +++ b/go.sum @@ -852,8 +852,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= -golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ= +golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= diff --git a/pkg/band/band_test.go b/pkg/band/band_test.go index 819f8f83a0..00f192e8cc 100644 --- a/pkg/band/band_test.go +++ b/pkg/band/band_test.go @@ -1148,27 +1148,27 @@ func TestGenerateChMask(t *testing.T) { }, }, { - Cntl: 4, Mask: [16]bool{ false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, }, }, { - Cntl: 3, + Cntl: 1, Mask: [16]bool{ false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, }, }, { - Cntl: 1, + Cntl: 3, Mask: [16]bool{ false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, }, }, { + Cntl: 4, Mask: [16]bool{ false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, @@ -1221,7 +1221,6 @@ func TestGenerateChMask(t *testing.T) { }, }, { - Cntl: 3, Mask: [16]bool{ false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, @@ -1235,6 +1234,7 @@ func TestGenerateChMask(t *testing.T) { }, }, { + Cntl: 3, Mask: [16]bool{ false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, diff --git a/pkg/band/channel_mask.go b/pkg/band/channel_mask.go index e09fb60a19..557bb12ee5 100644 --- a/pkg/band/channel_mask.go +++ b/pkg/band/channel_mask.go @@ -446,8 +446,8 @@ func generateChMask72Generic(currentChs, desiredChs []bool, atomic bool) ([]ChMa // We also sort the masks descending on the number of enabled channels in order to ensure // that intermediary states through which the end device goes while parsing the masks // are valid (i.e. the total number of enabled channels is always greater than 0). - slices.SortFunc(pairs, func(a, b ChMaskCntlPair) bool { - return trueCount(a.Mask[:]...) >= trueCount(b.Mask[:]...) + slices.SortFunc(pairs, func(a, b ChMaskCntlPair) int { + return trueCount(b.Mask[:]...) - trueCount(a.Mask[:]...) }) return pairs, nil diff --git a/tools/go.mod b/tools/go.mod index d080c7af1b..8e02a0b415 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -231,9 +231,9 @@ require ( gocloud.dev v0.33.0 // indirect gocloud.dev/pubsub/natspubsub v0.33.0 // indirect golang.org/x/crypto v0.12.0 // indirect - golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect + golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect golang.org/x/image v0.5.0 // indirect - golang.org/x/mod v0.11.0 // indirect + golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.14.0 // indirect golang.org/x/oauth2 v0.10.0 // indirect golang.org/x/sync v0.3.0 // indirect @@ -241,7 +241,7 @@ require ( golang.org/x/term v0.11.0 // indirect golang.org/x/text v0.12.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.10.0 // indirect + golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.134.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/tools/go.sum b/tools/go.sum index 497be6b6bc..29b0683185 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -868,8 +868,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= -golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ= +golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -899,8 +899,8 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= -golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1132,8 +1132,8 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= -golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg= -golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= +golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 h1:Vve/L0v7CXXuxUmaMGIEK/dEeq7uiqb5qBgQrZzIE7E= +golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 642a1fa9e996123e93ad0389765185934c90bb06 Mon Sep 17 00:00:00 2001 From: Nicholas Cristofaro Date: Mon, 21 Aug 2023 13:45:06 -0300 Subject: [PATCH 6/6] dev: Upgrade pgx from v5.4.2 to v5.4.3 --- go.mod | 2 +- go.sum | 4 ++-- tools/go.mod | 2 +- tools/go.sum | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 581034a6c5..0d07a108fc 100644 --- a/go.mod +++ b/go.mod @@ -46,7 +46,7 @@ require ( github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef github.com/iancoleman/strcase v0.3.0 github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa - github.com/jackc/pgx/v5 v5.4.2 + github.com/jackc/pgx/v5 v5.4.3 github.com/jacobsa/crypto v0.0.0-20190317225127-9f44e2d11115 github.com/jarcoal/httpmock v1.3.0 github.com/jaytaylor/html2text v0.0.0-20211105163654-bc68cce691ba diff --git a/go.sum b/go.sum index 5f2d1baea9..cc1ec31073 100644 --- a/go.sum +++ b/go.sum @@ -473,8 +473,8 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.4.2 h1:u1gmGDwbdRUZiwisBm/Ky2M14uQyUP65bG8+20nnyrg= -github.com/jackc/pgx/v5 v5.4.2/go.mod h1:q6iHT8uDNXWiFNOlRqJzBTaSH3+2xCXkokxHZC5qWFY= +github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY= +github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= github.com/jacobsa/crypto v0.0.0-20190317225127-9f44e2d11115 h1:YuDUUFNM21CAbyPOpOP8BicaTD/0klJEKt5p8yuw+uY= github.com/jacobsa/crypto v0.0.0-20190317225127-9f44e2d11115/go.mod h1:LadVJg0XuawGk+8L1rYnIED8451UyNxEMdTWCEt5kmU= github.com/jacobsa/oglematchers v0.0.0-20150720000706-141901ea67cd h1:9GCSedGjMcLZCrusBZuo4tyKLpKUPenUUqi34AkuFmA= diff --git a/tools/go.mod b/tools/go.mod index d080c7af1b..31cf45f321 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -136,7 +136,7 @@ require ( github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect - github.com/jackc/pgx/v5 v5.4.2 // indirect + github.com/jackc/pgx/v5 v5.4.3 // indirect github.com/jacobsa/crypto v0.0.0-20190317225127-9f44e2d11115 // indirect github.com/jaytaylor/html2text v0.0.0-20211105163654-bc68cce691ba // indirect github.com/jinzhu/inflection v1.0.0 // indirect diff --git a/tools/go.sum b/tools/go.sum index 497be6b6bc..234fa938e5 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -476,8 +476,8 @@ github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsI github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.4.2 h1:u1gmGDwbdRUZiwisBm/Ky2M14uQyUP65bG8+20nnyrg= -github.com/jackc/pgx/v5 v5.4.2/go.mod h1:q6iHT8uDNXWiFNOlRqJzBTaSH3+2xCXkokxHZC5qWFY= +github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY= +github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= github.com/jacobsa/crypto v0.0.0-20190317225127-9f44e2d11115 h1:YuDUUFNM21CAbyPOpOP8BicaTD/0klJEKt5p8yuw+uY= github.com/jacobsa/crypto v0.0.0-20190317225127-9f44e2d11115/go.mod h1:LadVJg0XuawGk+8L1rYnIED8451UyNxEMdTWCEt5kmU= github.com/jacobsa/oglematchers v0.0.0-20150720000706-141901ea67cd h1:9GCSedGjMcLZCrusBZuo4tyKLpKUPenUUqi34AkuFmA=