mirror of
https://github.com/juanfont/headscale.git
synced 2025-02-22 21:08:31 +00:00
Linting fixes + disable interfacebloat linter
This commit is contained in:
parent
9f64ac8a33
commit
b3f5af30a4
@ -33,6 +33,9 @@ linters:
|
|||||||
- makezero
|
- makezero
|
||||||
- maintidx
|
- maintidx
|
||||||
|
|
||||||
|
# Limits the methods of an interface to 10. We have more in integration tests
|
||||||
|
- interfacebloat
|
||||||
|
|
||||||
# We might want to enable this, but it might be a lot of work
|
# We might want to enable this, but it might be a lot of work
|
||||||
- cyclop
|
- cyclop
|
||||||
- nestif
|
- nestif
|
||||||
|
@ -2,6 +2,7 @@ package integration
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
@ -11,6 +12,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var errParseAuthPage = errors.New("failed to parse auth page")
|
||||||
|
|
||||||
type AuthWebFlowScenario struct {
|
type AuthWebFlowScenario struct {
|
||||||
*Scenario
|
*Scenario
|
||||||
}
|
}
|
||||||
@ -157,8 +160,18 @@ func (s *AuthWebFlowScenario) runHeadscaleRegister(namespaceStr string, loginURL
|
|||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
// see api.go HTML template
|
// see api.go HTML template
|
||||||
code := strings.Split(string(body), "</code>")[0]
|
codeSep := strings.Split(string(body), "</code>")
|
||||||
key := strings.Split(code, "key ")[1]
|
if len(codeSep) != 2 {
|
||||||
|
return errParseAuthPage
|
||||||
|
}
|
||||||
|
|
||||||
|
keySep := strings.Split(codeSep[0], "key ")
|
||||||
|
if len(keySep) != 2 {
|
||||||
|
return errParseAuthPage
|
||||||
|
}
|
||||||
|
key := keySep[1]
|
||||||
|
log.Printf("registering node %s", key)
|
||||||
|
|
||||||
if headscale, ok := s.controlServers["headscale"]; ok {
|
if headscale, ok := s.controlServers["headscale"]; ok {
|
||||||
_, err = headscale.Execute([]string{"headscale", "-n", namespaceStr, "nodes", "register", "--key", key})
|
_, err = headscale.Execute([]string{"headscale", "-n", namespaceStr, "nodes", "register", "--key", key})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -167,8 +180,6 @@ func (s *AuthWebFlowScenario) runHeadscaleRegister(namespaceStr string, loginURL
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("registered node %s", key)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user