mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-20 19:09:07 +01:00
Skip integration tests on short or lack of docker
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
a9c3b14f79
commit
eda4321486
@ -1,6 +1,18 @@
|
|||||||
package dockertestutil
|
package dockertestutil
|
||||||
|
|
||||||
import "github.com/ory/dockertest/v3/docker"
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/ory/dockertest/v3/docker"
|
||||||
|
)
|
||||||
|
|
||||||
|
func IsRunningInContainer() bool {
|
||||||
|
if _, err := os.Stat("/.dockerenv"); err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func DockerRestartPolicy(config *docker.HostConfig) {
|
func DockerRestartPolicy(config *docker.HostConfig) {
|
||||||
// set AutoRemove to true so that stopped container goes away by itself on error *immediately*.
|
// set AutoRemove to true so that stopped container goes away by itself on error *immediately*.
|
||||||
|
@ -3,10 +3,24 @@ package integration
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/juanfont/headscale/integration/dockertestutil"
|
||||||
"github.com/juanfont/headscale/integration/tsic"
|
"github.com/juanfont/headscale/integration/tsic"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func IntegrationSkip(t *testing.T) {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
|
if !dockertestutil.IsRunningInContainer() {
|
||||||
|
t.Skip("not running in docker, skipping")
|
||||||
|
}
|
||||||
|
|
||||||
|
if testing.Short() {
|
||||||
|
t.Skip("skipping integration tests due to short flag")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestHeadscale(t *testing.T) {
|
func TestHeadscale(t *testing.T) {
|
||||||
|
IntegrationSkip(t)
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
scenario, err := NewScenario()
|
scenario, err := NewScenario()
|
||||||
@ -52,6 +66,8 @@ func TestHeadscale(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateTailscale(t *testing.T) {
|
func TestCreateTailscale(t *testing.T) {
|
||||||
|
IntegrationSkip(t)
|
||||||
|
|
||||||
var scenario *Scenario
|
var scenario *Scenario
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
@ -84,6 +100,8 @@ func TestCreateTailscale(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTailscaleNodesJoiningHeadcale(t *testing.T) {
|
func TestTailscaleNodesJoiningHeadcale(t *testing.T) {
|
||||||
|
IntegrationSkip(t)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
namespace := "join-node-test"
|
namespace := "join-node-test"
|
||||||
|
Loading…
Reference in New Issue
Block a user