cli: migrate the CLI and integration tests to the v1 HTTP API

Replace the gRPC client with the generated HTTP client across every
command: locally over the unix socket without auth (matching the previous
local gRPC socket), remotely over TLS with a Bearer API key. Output
rendering and integration tests move to the HTTP client types; the
transport changes, the assertions do not.
This commit is contained in:
Kristoffer Dalby
2026-06-19 06:13:50 +00:00
parent ba90048cfb
commit 8efa5ad1fe
35 changed files with 1654 additions and 1371 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ package integration
import (
"testing"
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
clientv1 "github.com/juanfont/headscale/gen/client/v1"
"github.com/juanfont/headscale/hscontrol/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -20,10 +20,10 @@ func TestServerInfoCommands(t *testing.T) {
defer scenario.ShutdownAssertNoPanics(t)
t.Run("health", func(t *testing.T) {
health := assertJSONRoundtrip[*v1.HealthResponse](t, headscale, []string{
health := assertJSONRoundtrip[*clientv1.HealthResponseBody](t, headscale, []string{
"headscale", "health", "--output", "json",
})
assert.True(t, health.GetDatabaseConnectivity(), "database should be reachable")
assert.True(t, health.DatabaseConnectivity, "database should be reachable")
})
t.Run("version", func(t *testing.T) {