chore: bump Go to 1.24.0
This commit is contained in:
parent
9c267e0f35
commit
6e369a20ca
6
.github/workflows/ci-build.yml
vendored
6
.github/workflows/ci-build.yml
vendored
@ -27,15 +27,15 @@ jobs:
|
||||
ffmpeg-version: release
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Go 1.23.5
|
||||
- name: Setup Go 1.24.0
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23.5'
|
||||
go-version: '1.24.0'
|
||||
cache: false
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
version: v1.60.1
|
||||
version: v1.64.2
|
||||
- name: check_gomod
|
||||
run: mise run check_gomod
|
||||
- name: test_ci
|
||||
|
@ -1,7 +1,6 @@
|
||||
package container
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"testing"
|
||||
@ -12,9 +11,6 @@ import (
|
||||
)
|
||||
|
||||
func TestHandleEvents(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
t.Cleanup(cancel)
|
||||
|
||||
var count int
|
||||
eventsC1 := make(chan events.Message)
|
||||
eventsC2 := make(chan events.Message)
|
||||
@ -37,7 +33,7 @@ func TestHandleEvents(t *testing.T) {
|
||||
go func() {
|
||||
defer close(done)
|
||||
|
||||
handleEvents(ctx, containerID, &dockerClient, logger, ch)
|
||||
handleEvents(t.Context(), containerID, &dockerClient, logger, ch)
|
||||
}()
|
||||
|
||||
go func() {
|
||||
|
@ -3,7 +3,6 @@ package container
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
_ "embed"
|
||||
"io"
|
||||
"testing"
|
||||
@ -20,9 +19,6 @@ var statsJSON []byte
|
||||
var statsWithRestartJSON []byte
|
||||
|
||||
func TestHandleStats(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
t.Cleanup(cancel)
|
||||
|
||||
pr, pw := io.Pipe()
|
||||
containerID := "b905f51b47242090ae504c184c7bc84d6274511ef763c1847039dcaa00a3ad27"
|
||||
dockerClient := testhelpers.MockDockerClient{ContainerStatsResponse: pr}
|
||||
@ -33,7 +29,7 @@ func TestHandleStats(t *testing.T) {
|
||||
go func() {
|
||||
defer close(ch)
|
||||
|
||||
handleStats(ctx, containerID, &dockerClient, networkCountConfig, logger, ch)
|
||||
handleStats(t.Context(), containerID, &dockerClient, networkCountConfig, logger, ch)
|
||||
}()
|
||||
|
||||
go func() {
|
||||
@ -61,9 +57,6 @@ func TestHandleStats(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHandleStatsWithContainerRestart(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
t.Cleanup(cancel)
|
||||
|
||||
pr, pw := io.Pipe()
|
||||
containerID := "d0adc747fb12b9ce2376408aed8538a0769de55aa9c239313f231d9d80402e39"
|
||||
dockerClient := testhelpers.MockDockerClient{ContainerStatsResponse: pr}
|
||||
@ -74,7 +67,7 @@ func TestHandleStatsWithContainerRestart(t *testing.T) {
|
||||
go func() {
|
||||
defer close(ch)
|
||||
|
||||
handleStats(ctx, containerID, &dockerClient, networkCountConfig, logger, ch)
|
||||
handleStats(t.Context(), containerID, &dockerClient, networkCountConfig, logger, ch)
|
||||
}()
|
||||
|
||||
go func() {
|
||||
|
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
||||
module git.netflux.io/rob/termstream
|
||||
|
||||
go 1.23.5
|
||||
go 1.24.0
|
||||
|
||||
require (
|
||||
github.com/docker/docker v27.5.0+incompatible
|
||||
|
@ -1,7 +1,6 @@
|
||||
package mediaserver_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -16,22 +15,19 @@ import (
|
||||
const component = "mediaserver"
|
||||
|
||||
func TestMediaServerStartStop(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
t.Cleanup(cancel)
|
||||
|
||||
logger := testhelpers.NewTestLogger()
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
require.NoError(t, err)
|
||||
|
||||
containerClient, err := container.NewClient(ctx, apiClient, logger)
|
||||
containerClient, err := container.NewClient(t.Context(), apiClient, logger)
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(func() { require.NoError(t, containerClient.Close()) })
|
||||
|
||||
running, err := containerClient.ContainerRunning(ctx, map[string]string{"component": component})
|
||||
running, err := containerClient.ContainerRunning(t.Context(), map[string]string{"component": component})
|
||||
require.NoError(t, err)
|
||||
assert.False(t, running)
|
||||
|
||||
mediaServer := mediaserver.StartActor(ctx, mediaserver.StartActorParams{
|
||||
mediaServer := mediaserver.StartActor(t.Context(), mediaserver.StartActorParams{
|
||||
FetchIngressStateInterval: 500 * time.Millisecond,
|
||||
ChanSize: 1,
|
||||
ContainerClient: containerClient,
|
||||
@ -43,7 +39,7 @@ func TestMediaServerStartStop(t *testing.T) {
|
||||
require.Eventually(
|
||||
t,
|
||||
func() bool {
|
||||
running, err = containerClient.ContainerRunning(ctx, map[string]string{"component": component})
|
||||
running, err = containerClient.ContainerRunning(t.Context(), map[string]string{"component": component})
|
||||
return err == nil && running
|
||||
},
|
||||
time.Second*10,
|
||||
@ -81,7 +77,7 @@ func TestMediaServerStartStop(t *testing.T) {
|
||||
|
||||
mediaServer.Close()
|
||||
|
||||
running, err = containerClient.ContainerRunning(ctx, map[string]string{"component": component})
|
||||
running, err = containerClient.ContainerRunning(t.Context(), map[string]string{"component": component})
|
||||
require.NoError(t, err)
|
||||
assert.False(t, running)
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
[env]
|
||||
GOTOOLCHAIN = "go1.23.5"
|
||||
GOTOOLCHAIN = "go1.24.0"
|
||||
|
||||
[tasks.test]
|
||||
description = "Run tests"
|
||||
|
@ -1,7 +1,6 @@
|
||||
package multiplexer_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -17,22 +16,19 @@ import (
|
||||
const component = "multiplexer"
|
||||
|
||||
func TestMultiplexer(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
t.Cleanup(cancel)
|
||||
|
||||
logger := testhelpers.NewTestLogger()
|
||||
apiClient, err := client.NewClientWithOpts(client.FromEnv)
|
||||
require.NoError(t, err)
|
||||
|
||||
containerClient, err := container.NewClient(ctx, apiClient, logger)
|
||||
containerClient, err := container.NewClient(t.Context(), apiClient, logger)
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(func() { require.NoError(t, containerClient.Close()) })
|
||||
|
||||
running, err := containerClient.ContainerRunning(ctx, map[string]string{"component": component})
|
||||
running, err := containerClient.ContainerRunning(t.Context(), map[string]string{"component": component})
|
||||
require.NoError(t, err)
|
||||
assert.False(t, running)
|
||||
|
||||
srv := mediaserver.StartActor(ctx, mediaserver.StartActorParams{
|
||||
srv := mediaserver.StartActor(t.Context(), mediaserver.StartActorParams{
|
||||
RTMPPort: 19350,
|
||||
APIPort: 9998,
|
||||
FetchIngressStateInterval: 250 * time.Millisecond,
|
||||
@ -54,7 +50,7 @@ func TestMultiplexer(t *testing.T) {
|
||||
"source not live",
|
||||
)
|
||||
|
||||
mp := multiplexer.NewActor(ctx, multiplexer.NewActorParams{
|
||||
mp := multiplexer.NewActor(t.Context(), multiplexer.NewActorParams{
|
||||
SourceURL: srv.State().RTMPInternalURL,
|
||||
ChanSize: 1,
|
||||
ContainerClient: containerClient,
|
||||
|
@ -1,16 +1,13 @@
|
||||
package testhelpers
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log/slog"
|
||||
"os"
|
||||
)
|
||||
|
||||
// NewNopLogger returns a logger that discards all log output.
|
||||
//
|
||||
// TODO: remove in Go 1.24: https://github.com/golang/go/issues/62005
|
||||
func NewNopLogger() *slog.Logger {
|
||||
return slog.New(slog.NewJSONHandler(io.Discard, nil))
|
||||
return slog.New(slog.DiscardHandler)
|
||||
}
|
||||
|
||||
// NewTestLogger returns a logger that writes to stderr.
|
||||
|
Loading…
x
Reference in New Issue
Block a user