Files
zeekayandHanzo Dev e9e9fb6315 Give the node's HTTP server a home beside the VMs it serves
api/server was an earlier copy of node/server/http that had drifted behind it.
Its exported surface was a strict subset of the node's, so this replaces the
contents rather than adding a second package: a second server would have meant
two Server interfaces, two New, two routers, and no answer to which one a chain
should mount on.

What arrives with it is the part api/server never had. Mount is the estate's
only projection from a zip App to an http.Handler, and it installs Authorize
before it serves, so an app cannot reach the router without the node's
authorization decision on it. Chain builds the one address a chain answers at,
and chain_test walks this module's own source to hold every caller to it. The
ZAP-RPC listener and the /v1 prefix come across as well; api/server was still
serving /ext.

Two files stay behind because they already have homes here. The node's
traced_handler duplicates api.TraceHandler, which this package was already
calling, so server.go keeps calling it and takes luxfi/trace in place of the
node-local trace shim.

Two tests do not come across, and neither is dropped from the node. mount_test
builds a real Z-Chain from luxfi/chains, which requires luxfi/vm, so importing
it here would point the layering back at itself. probe_test needs the Ops app
on node/service/health, which api/health does not carry. Both keep running
where they are.

constants moves to v1.6.4 to agree with the node on the chain segment. The two
modules disagreed, v1.6.2 still saying bc where the node says chain, and the
address Chain builds has to be the address the node's router serves.

newMetrics now reports a duplicate registration instead of returning a
half-built set, which is what TestMetricsRegistrationFailure had been asking
for and failing to get. That test stays, next to the node's, because the two
ask different questions: one registry twice, or two registries once.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-06 12:21:19 -07:00

149 lines
4.7 KiB
Go

// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/luxfi/vm/api/server (interfaces: Server)
//
// Generated by this command:
//
// mockgen -package=servermock -destination=api/server/servermock/server.go -mock_names=Server=Server github.com/luxfi/vm/api/server Server
//
// Package servermock is a generated GoMock package.
package servermock
import (
http "net/http"
reflect "reflect"
"github.com/luxfi/runtime"
"github.com/luxfi/vm"
gomock "go.uber.org/mock/gomock"
)
// Server is a mock of Server interface.
type Server struct {
ctrl *gomock.Controller
recorder *ServerMockRecorder
}
// ServerMockRecorder is the mock recorder for Server.
type ServerMockRecorder struct {
mock *Server
}
// NewServer creates a new mock instance.
func NewServer(ctrl *gomock.Controller) *Server {
mock := &Server{ctrl: ctrl}
mock.recorder = &ServerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *Server) EXPECT() *ServerMockRecorder {
return m.recorder
}
// AddAliases mocks base method.
func (m *Server) AddAliases(arg0 string, arg1 ...string) error {
m.ctrl.T.Helper()
varargs := []any{arg0}
for _, a := range arg1 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "AddAliases", varargs...)
ret0, _ := ret[0].(error)
return ret0
}
// AddAliases indicates an expected call of AddAliases.
func (mr *ServerMockRecorder) AddAliases(arg0 any, arg1 ...any) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{arg0}, arg1...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddAliases", reflect.TypeOf((*Server)(nil).AddAliases), varargs...)
}
// AddAliasesWithReadLock mocks base method.
func (m *Server) AddAliasesWithReadLock(arg0 string, arg1 ...string) error {
m.ctrl.T.Helper()
varargs := []any{arg0}
for _, a := range arg1 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "AddAliasesWithReadLock", varargs...)
ret0, _ := ret[0].(error)
return ret0
}
// AddAliasesWithReadLock indicates an expected call of AddAliasesWithReadLock.
func (mr *ServerMockRecorder) AddAliasesWithReadLock(arg0 any, arg1 ...any) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{arg0}, arg1...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddAliasesWithReadLock", reflect.TypeOf((*Server)(nil).AddAliasesWithReadLock), varargs...)
}
// AddRoute mocks base method.
func (m *Server) AddRoute(arg0 http.Handler, arg1, arg2 string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AddRoute", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
}
// AddRoute indicates an expected call of AddRoute.
func (mr *ServerMockRecorder) AddRoute(arg0, arg1, arg2 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRoute", reflect.TypeOf((*Server)(nil).AddRoute), arg0, arg1, arg2)
}
// AddRouteWithReadLock mocks base method.
func (m *Server) AddRouteWithReadLock(arg0 http.Handler, arg1, arg2 string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AddRouteWithReadLock", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
}
// AddRouteWithReadLock indicates an expected call of AddRouteWithReadLock.
func (mr *ServerMockRecorder) AddRouteWithReadLock(arg0, arg1, arg2 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRouteWithReadLock", reflect.TypeOf((*Server)(nil).AddRouteWithReadLock), arg0, arg1, arg2)
}
// Dispatch mocks base method.
func (m *Server) Dispatch() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Dispatch")
ret0, _ := ret[0].(error)
return ret0
}
// Dispatch indicates an expected call of Dispatch.
func (mr *ServerMockRecorder) Dispatch() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Dispatch", reflect.TypeOf((*Server)(nil).Dispatch))
}
// RegisterChain mocks base method.
func (m *Server) RegisterChain(arg0 string, arg1 *runtime.Runtime, arg2 vm.VM) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "RegisterChain", arg0, arg1, arg2)
}
// RegisterChain indicates an expected call of RegisterChain.
func (mr *ServerMockRecorder) RegisterChain(arg0, arg1, arg2 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterChain", reflect.TypeOf((*Server)(nil).RegisterChain), arg0, arg1, arg2)
}
// Shutdown mocks base method.
func (m *Server) Shutdown() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Shutdown")
ret0, _ := ret[0].(error)
return ret0
}
// Shutdown indicates an expected call of Shutdown.
func (mr *ServerMockRecorder) Shutdown() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Shutdown", reflect.TypeOf((*Server)(nil).Shutdown))
}