Skip to content

Commit

Permalink
Remove isolate.
Browse files Browse the repository at this point in the history
  • Loading branch information
blakerouse committed Oct 9, 2023
1 parent 113c894 commit 0fb9405
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 265 deletions.
13 changes: 1 addition & 12 deletions pkg/testing/define/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ type Batch struct {
// Stack defines the stack required for this batch.
Stack *Stack `json:"stack,omitempty"`

// Isolate defines that this batch is isolated to a single test.
Isolate bool `json:"isolate"`

// Tests define the set of packages and tests that do not require sudo
// privileges to be performed.
Tests []BatchPackageTests `json:"tests"`
Expand Down Expand Up @@ -181,16 +178,12 @@ func appendTest(batches []Batch, tar testActionResult, req Requirements) []Batch
}
for _, o := range set {
var batch Batch
batchIdx := -1
if !req.Isolate {
batchIdx = findBatchIdx(batches, req.Group, o, req.Stack)
}
batchIdx := findBatchIdx(batches, req.Group, o, req.Stack)
if batchIdx == -1 {
// new batch required
batch = Batch{
Group: req.Group,
OS: o,
Isolate: req.Isolate,
Tests: nil,
SudoTests: nil,
}
Expand Down Expand Up @@ -248,10 +241,6 @@ func appendPackageTest(tests []BatchPackageTests, pkg string, name string, stack

func findBatchIdx(batches []Batch, group string, os OS, stack *Stack) int {
for i, b := range batches {
if b.Isolate {
// never add to an isolate batch
continue
}
if b.Group != group {
// must be in the same group
continue
Expand Down
180 changes: 0 additions & 180 deletions pkg/testing/define/batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,186 +164,6 @@ func TestBatch(t *testing.T) {
Tests: windowsLocalTests,
SudoTests: windowsSudoTests,
},
{
Group: "default",
OS: OS{
Type: Darwin,
Arch: AMD64,
},
Isolate: true,
Tests: []BatchPackageTests{
{
Name: pkgName,
Tests: []BatchPackageTest{
{
Name: "TestAnyIsolate",
},
},
},
},
},
{
Group: "default",
OS: OS{
Type: Darwin,
Arch: ARM64,
},
Isolate: true,
Tests: []BatchPackageTests{
{
Name: pkgName,
Tests: []BatchPackageTest{
{
Name: "TestAnyIsolate",
},
},
},
},
},
{
Group: "default",
OS: OS{
Type: Linux,
Arch: AMD64,
},
Isolate: true,
Tests: []BatchPackageTests{
{
Name: pkgName,
Tests: []BatchPackageTest{
{
Name: "TestAnyIsolate",
},
},
},
},
},
{
Group: "default",
OS: OS{
Type: Linux,
Arch: ARM64,
},
Isolate: true,
Tests: []BatchPackageTests{
{
Name: pkgName,
Tests: []BatchPackageTest{
{
Name: "TestAnyIsolate",
},
},
},
},
},
{
Group: "default",
OS: OS{
Type: Windows,
Arch: AMD64,
},
Isolate: true,
Tests: []BatchPackageTests{
{
Name: pkgName,
Tests: []BatchPackageTest{
{
Name: "TestAnyIsolate",
},
},
},
},
},
{
Group: "default",
OS: OS{
Type: Darwin,
Arch: AMD64,
},
Isolate: true,
Tests: []BatchPackageTests{
{
Name: pkgName,
Tests: []BatchPackageTest{
{
Name: "TestDarwinIsolate",
},
},
},
},
},
{
Group: "default",
OS: OS{
Type: Darwin,
Arch: ARM64,
},
Isolate: true,
Tests: []BatchPackageTests{
{
Name: pkgName,
Tests: []BatchPackageTest{
{
Name: "TestDarwinIsolate",
},
},
},
},
},
{
Group: "default",
OS: OS{
Type: Linux,
Arch: AMD64,
},
Isolate: true,
Tests: []BatchPackageTests{
{
Name: pkgName,
Tests: []BatchPackageTest{
{
Name: "TestLinuxIsolate",
},
},
},
},
},
{
Group: "default",
OS: OS{
Type: Linux,
Arch: ARM64,
},
Isolate: true,
Tests: []BatchPackageTests{
{
Name: pkgName,
Tests: []BatchPackageTest{
{
Name: "TestLinuxIsolate",
},
},
},
},
},
{
Group: "default",
OS: OS{
Type: Windows,
Arch: AMD64,
},
Isolate: true,
Tests: []BatchPackageTests{
{
Name: pkgName,
Tests: []BatchPackageTest{
{
Name: "TestWindowsIsolate",
},
},
},
},
},
{
Group: "one",
OS: OS{
Expand Down
4 changes: 0 additions & 4 deletions pkg/testing/define/requirements.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ type Requirements struct {
// when a full test run is performed.
Local bool `json:"local"`

// Isolate defines that this test must be isolated to its own dedicated VM and the test
// cannot be shared with other tests.
Isolate bool `json:"isolate"`

// Sudo defines that this test must run under superuser permissions. On Mac and Linux the
// test gets executed under sudo and on Windows it gets run under Administrator.
Sudo bool `json:"sudo"`
Expand Down
43 changes: 0 additions & 43 deletions pkg/testing/define/testdata/sample_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ func TestAnySudo(t *testing.T) {
})
}

func TestAnyIsolate(t *testing.T) {
define.Require(t, define.Requirements{
Group: "default",
Isolate: true,
})
}

func TestDarwinLocal(t *testing.T) {
define.Require(t, define.Requirements{
Group: "default",
Expand All @@ -57,18 +50,6 @@ func TestDarwinSudo(t *testing.T) {
})
}

func TestDarwinIsolate(t *testing.T) {
define.Require(t, define.Requirements{
Group: "default",
OS: []define.OS{
{
Type: define.Darwin,
},
},
Isolate: true,
})
}

func TestLinuxLocal(t *testing.T) {
define.Require(t, define.Requirements{
Group: "default",
Expand All @@ -93,18 +74,6 @@ func TestLinuxSudo(t *testing.T) {
})
}

func TestLinuxIsolate(t *testing.T) {
define.Require(t, define.Requirements{
Group: "default",
OS: []define.OS{
{
Type: define.Linux,
},
},
Isolate: true,
})
}

func TestWindowsLocal(t *testing.T) {
define.Require(t, define.Requirements{
Group: "default",
Expand All @@ -129,18 +98,6 @@ func TestWindowsSudo(t *testing.T) {
})
}

func TestWindowsIsolate(t *testing.T) {
define.Require(t, define.Requirements{
Group: "default",
OS: []define.OS{
{
Type: define.Windows,
},
},
Isolate: true,
})
}

func TestSpecificCombinationOne(t *testing.T) {
define.Require(t, define.Requirements{
Group: "default",
Expand Down
11 changes: 0 additions & 11 deletions pkg/testing/ogc/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"context"
"fmt"
"os"
"path"
"path/filepath"
"strings"
"time"
Expand Down Expand Up @@ -290,16 +289,6 @@ func osBatchToOGC(cacheDir string, batch runner.OSBatch) Layout {
} else {
tags = append(tags, strings.ToLower(fmt.Sprintf("%s-%s", batch.OS.Type, strings.Replace(batch.OS.Version, ".", "-", -1))))
}
if batch.Batch.Isolate {
tags = append(tags, "isolate")
var test define.BatchPackageTests
if len(batch.Batch.SudoTests) > 0 {
test = batch.Batch.SudoTests[0]
} else if len(batch.Batch.Tests) > 0 {
test = batch.Batch.Tests[0]
}
tags = append(tags, fmt.Sprintf("%s-%s", path.Base(test.Name), strings.ToLower(test.Tests[0].Name)))
}
los, _ := findOSLayout(batch.OS.OS)
return Layout{
Name: batch.ID,
Expand Down
10 changes: 0 additions & 10 deletions pkg/testing/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -962,16 +962,6 @@ func createBatchID(batch OSBatch) string {
}
id += "-" + strings.Replace(batch.OS.Version, ".", "", -1)
id += "-" + strings.Replace(batch.Batch.Group, ".", "", -1)
if batch.Batch.Isolate {
if len(batch.Batch.Tests) > 0 {
// only ever has one test in an isolated batch
id += "-" + batch.Batch.Tests[0].Tests[0].Name
}
if len(batch.Batch.SudoTests) > 0 {
// only ever has one test in an isolated batch
id += "-" + batch.Batch.SudoTests[0].Tests[0].Name
}
}
return strings.ToLower(id)
}

Expand Down
9 changes: 4 additions & 5 deletions testing/integration/endpoint_security_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,10 @@ func installElasticDefendPackage(t *testing.T, info *define.Info, policyID strin
// path other than default
func TestEndpointSecurityNonDefaultBasePath(t *testing.T) {
info := define.Require(t, define.Requirements{
Group: "endpoint",
Stack: &define.Stack{},
Local: false, // requires Agent installation
Isolate: false,
Sudo: true, // requires Agent installation
Group: "endpoint",
Stack: &define.Stack{},
Local: false, // requires Agent installation
Sudo: true, // requires Agent installation
})

ctx, cn := context.WithCancel(context.Background())
Expand Down

0 comments on commit 0fb9405

Please sign in to comment.