mirror of
https://github.com/siderolabs/talos.git
synced 2025-12-04 17:11:27 +01:00
See https://github.com/siderolabs/ethtool - our fork. This PR covers only configuring rings, follow-up PRs will address other pieces: channels and features. Example: ``` node: 172.20.0.5 metadata: namespace: network type: EthernetStatuses.net.talos.dev id: enp0s2 version: 4 owner: network.EthernetStatusController phase: running created: 2025-02-04T16:03:14Z updated: 2025-02-04T16:04:12Z spec: linkState: true port: Other duplex: Unknown rings: rx-max: 256 tx-max: 256 rx: 128 tx: 128 tx-push: false rx-push: false ``` Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
57 lines
1.6 KiB
Go
57 lines
1.6 KiB
Go
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
package network_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/cosi-project/runtime/pkg/resource/meta"
|
|
"github.com/cosi-project/runtime/pkg/state"
|
|
"github.com/cosi-project/runtime/pkg/state/impl/inmem"
|
|
"github.com/cosi-project/runtime/pkg/state/impl/namespaced"
|
|
"github.com/cosi-project/runtime/pkg/state/registry"
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/siderolabs/talos/pkg/machinery/resources/network"
|
|
)
|
|
|
|
func TestRegisterResource(t *testing.T) {
|
|
ctx := context.TODO()
|
|
|
|
resources := state.WrapCore(namespaced.NewState(inmem.Build))
|
|
resourceRegistry := registry.NewResourceRegistry(resources)
|
|
|
|
for _, resource := range []meta.ResourceWithRD{
|
|
&network.AddressStatus{},
|
|
&network.AddressSpec{},
|
|
&network.HardwareAddr{},
|
|
&network.DNSUpstream{},
|
|
&network.EthernetSpec{},
|
|
&network.EthernetStatus{},
|
|
&network.HostDNSConfig{},
|
|
&network.HostnameStatus{},
|
|
&network.HostnameSpec{},
|
|
&network.LinkRefresh{},
|
|
&network.LinkStatus{},
|
|
&network.LinkSpec{},
|
|
&network.NfTablesChain{},
|
|
&network.NodeAddress{},
|
|
&network.NodeAddressFilter{},
|
|
&network.NodeAddressSortAlgorithm{},
|
|
&network.OperatorSpec{},
|
|
&network.ProbeSpec{},
|
|
&network.ResolverStatus{},
|
|
&network.ResolverSpec{},
|
|
&network.RouteStatus{},
|
|
&network.RouteSpec{},
|
|
&network.Status{},
|
|
&network.TimeServerStatus{},
|
|
&network.TimeServerSpec{},
|
|
} {
|
|
assert.NoError(t, resourceRegistry.Register(ctx, resource))
|
|
}
|
|
}
|