Skip to content

Commit 6aff6bb

Browse files
committed
test: use bridge IP for WireGuard in CI
It was using local pod IP which was generating new schematic every time the test runs. Signed-off-by: Artem Chernyshev <[email protected]>
1 parent e60c821 commit 6aff6bb

File tree

8 files changed

+29
-31
lines changed

8 files changed

+29
-31
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2025-09-30T16:42:42Z by kres bc281a9.
3+
# Generated on 2025-10-17T13:27:48Z by kres 46e133d.
44

55
*
66
!frontend/src

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2025-10-17T10:42:53Z by kres 46e133d.
3+
# Generated on 2025-10-17T13:27:48Z by kres 46e133d.
44

55
concurrency:
66
group: ${{ github.head_ref || github.run_id }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
44
#
5-
# Generated on 2025-10-17T10:27:59Z by kres 46e133d.
5+
# Generated on 2025-10-17T13:27:48Z by kres 46e133d.
66

77
ARG JS_TOOLCHAIN
88
ARG TOOLCHAIN

hack/test/integration.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,19 @@ chown -R ${SUDO_USER:-$(whoami)} ${ARTIFACTS}
6767

6868
# Determine the local IP SideroLink API will listen on
6969
LOCAL_IP=$(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p')
70+
WIREGUARD_IP=$LOCAL_IP
71+
72+
if [[ "${CI:-false}" == "true" ]]; then
73+
WIREGUARD_IP=172.20.0.1
74+
fi
7075

7176
# Prepare schematic with kernel args
7277
KERNEL_ARGS_SCHEMATIC=$(
7378
cat <<EOF
7479
customization:
7580
extraKernelArgs:
76-
- siderolink.api=grpc://$LOCAL_IP:8090?jointoken=${JOIN_TOKEN}
77-
- talos.events.sink=[fdae:41e4:649b:9303::1]:8090
81+
- siderolink.api=grpc://${WIREGUARD_IP}:8090?jointoken=${JOIN_TOKEN}
82+
- talos.events.sink=[fdae:41e4:649b:9303::1]:8091
7883
- talos.logging.kernel=tcp://[fdae:41e4:649b:9303::1]:8092
7984
systemExtensions:
8085
officialExtensions:
@@ -181,8 +186,9 @@ services:
181186
endpoint: ${LOCAL_IP}:50180
182187
advertisedEndpoint: ${LOCAL_IP}:50180
183188
joinTokensMode: strict
189+
eventSinkPort: 8091
184190
machineAPI:
185-
endpoint: ${LOCAL_IP}:8090
191+
endpoint: 0.0.0.0:8090
186192
advertisedURL: grpc://${LOCAL_IP}:8090
187193
workloadProxy:
188194
enabled: true
@@ -281,7 +287,7 @@ function prepare_partial_config() {
281287
cat <<EOF
282288
apiVersion: v1alpha1
283289
kind: SideroLinkConfig
284-
apiUrl: grpc://$LOCAL_IP:8090?jointoken=${JOIN_TOKEN}
290+
apiUrl: grpc://${WIREGUARD_IP}:8090?jointoken=${JOIN_TOKEN}
285291
---
286292
apiVersion: v1alpha1
287293
kind: EventSinkConfig
@@ -299,15 +305,15 @@ EOF
299305
echo "${partial_config}" >"${partial_config_dir}/config.yaml"
300306

301307
# Start a simple HTTP server to serve the partial config
302-
python3 -m http.server $port --bind "$LOCAL_IP" --directory "$partial_config_dir" >/dev/null 2>&1 &
308+
python3 -m http.server $port --bind "0.0.0.0" --directory "$partial_config_dir" >/dev/null 2>&1 &
303309
PARTIAL_CONFIG_SERVER_PID=$! # capture the PID to kill it in cleanup
304310

305311
local schematic
306312
schematic=$(
307313
cat <<EOF
308314
customization:
309315
extraKernelArgs:
310-
- talos.config=http://$LOCAL_IP:$port/config.yaml
316+
- talos.config=http://${WIREGUARD_IP}:$port/config.yaml
311317
systemExtensions:
312318
officialExtensions:
313319
- siderolabs/hello-world-service
@@ -552,6 +558,7 @@ if [ "${INTEGRATION_RUN_E2E_TEST:-true}" == "true" ]; then
552558
nice -n 10 ${ARTIFACTS}/omni-linux-amd64 --config-path ${TEST_OUTPUTS_DIR}/e2e-config.yaml \
553559
--siderolink-wireguard-advertised-addr $LOCAL_IP:50180 \
554560
--siderolink-api-advertised-url "grpc://$LOCAL_IP:8090" \
561+
--event-sink-port 8091 \
555562
--auth-auth0-enabled true \
556563
--auth-auth0-client-id "${AUTH0_CLIENT_ID}" \
557564
--auth-auth0-domain "${AUTH0_DOMAIN}" \

internal/backend/grpc/support.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func (s *managementServer) collectLogs(machineID string) *collectors.Collector {
189189
r, err := s.logHandler.GetReader(slink.MachineID(machineID), false, optional.None[int32]())
190190
if err != nil {
191191
if slink.IsBufferNotFoundError(err) {
192-
return nil, nil
192+
return []byte{}, nil
193193
}
194194

195195
return nil, err

internal/backend/runtime/omni/controllers/omni/machine_request_set_status_test.go

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -260,24 +260,15 @@ func (suite *MachineRequestSetStatusSuite) reconcileLabels(ctx context.Context)
260260

261261
res := system.NewResourceLabels[*omni.MachineStatus](status.TypedSpec().Value.Id)
262262

263-
res.Metadata().Labels().Set(omni.LabelMachineRequest, status.Metadata().ID())
263+
err = safe.StateModify(ctx, suite.state, res, func(r *system.ResourceLabels[*omni.MachineStatus]) error {
264+
res.Metadata().Labels().Set(omni.LabelMachineRequest, status.Metadata().ID())
264265

265-
helpers.CopyAllLabels(status, res)
266+
helpers.CopyAllLabels(status, r)
266267

267-
err = suite.state.Create(ctx, res)
268+
return nil
269+
})
268270
if err != nil {
269-
if !state.IsConflictError(err) {
270-
return err
271-
}
272-
273-
_, err = safe.StateUpdateWithConflicts(ctx, suite.state, res.Metadata(), func(r *system.ResourceLabels[*omni.MachineStatus]) error {
274-
helpers.CopyAllLabels(status, r)
275-
276-
return nil
277-
})
278-
if err != nil {
279-
return err
280-
}
271+
return err
281272
}
282273
}
283274
}

internal/integration/maintenance_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
const testPatch = `apiVersion: v1alpha1
2626
kind: EventSinkConfig
27-
endpoint: '[fdae:41e4:649b:9303::1]:8090'`
27+
endpoint: '[fdae:41e4:649b:9303::1]:8091'`
2828

2929
// AssertMaintenanceTestConfigIsPresent asserts that the test configuration is present on a machine in maintenance mode.
3030
func AssertMaintenanceTestConfigIsPresent(ctx context.Context, omniState state.State, cluster resource.ID, machineIndex int) TestFunc {

internal/integration/talos_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -852,11 +852,15 @@ func AssertTalosServiceIsRestarted(testCtx context.Context, cli *client.Client,
852852
// AssertSupportBundleContents tries to upgrade get Talos/Omni support bundle, and verifies that it has some contents.
853853
func AssertSupportBundleContents(testCtx context.Context, cli *client.Client, clusterName string) TestFunc {
854854
return func(t *testing.T) {
855-
ctx, cancel := context.WithTimeout(testCtx, 10*time.Second)
855+
ctx, cancel := context.WithTimeout(testCtx, 30*time.Second)
856856
defer cancel()
857857

858858
require := require.New(t)
859859

860+
// check that all machines have logs using Omni API
861+
machines, err := safe.ReaderListAll[*omni.ClusterMachine](ctx, cli.Omni().State(), state.WithLabelQuery(resource.LabelEqual(omni.LabelCluster, clusterName)))
862+
require.NoError(err)
863+
860864
progress := make(chan *management.GetSupportBundleResponse_Progress)
861865

862866
var eg errgroup.Group
@@ -906,10 +910,6 @@ func AssertSupportBundleContents(testCtx context.Context, cli *client.Client, cl
906910
// check some resource that always exists
907911
require.NotEmpty(readArchiveFile(fmt.Sprintf("omni/resources/Clusters.omni.sidero.dev-%s.yaml", clusterName)))
908912

909-
// check that all machines have logs
910-
machines, err := safe.ReaderListAll[*omni.ClusterMachine](ctx, cli.Omni().State(), state.WithLabelQuery(resource.LabelEqual(omni.LabelCluster, clusterName)))
911-
require.NoError(err)
912-
913913
machines.ForEach(func(cm *omni.ClusterMachine) {
914914
require.NotEmpty(readArchiveFile(fmt.Sprintf("omni/machine-logs/%s.log", cm.Metadata().ID())))
915915
})

0 commit comments

Comments
 (0)