Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update e2e provisioning to support root podman
Excludes setup for rootless podman. updates source ami to ubuntu 18.04 Installs podman and configures podman varlink base podman test ensure client status running revert terraform directory changes
- Loading branch information
1 parent
728da4d
commit 508007d
Showing
19 changed files
with
299 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
job "redis" { | ||
datacenters = ["dc1"] | ||
type = "service" | ||
|
||
group "redis" { | ||
task "redis" { | ||
driver = "podman" | ||
|
||
config { | ||
image = "docker://redis" | ||
|
||
port_map { | ||
redis = 6379 | ||
} | ||
} | ||
|
||
resources { | ||
cpu = 500 | ||
memory = 256 | ||
|
||
network { | ||
mbits = 20 | ||
port "redis" {} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package podman | ||
|
||
import ( | ||
"github.com/hashicorp/nomad/e2e/e2eutil" | ||
"github.com/hashicorp/nomad/e2e/framework" | ||
"github.com/hashicorp/nomad/helper/uuid" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
type PodmanTest struct { | ||
framework.TC | ||
jobIDs []string | ||
} | ||
|
||
func init() { | ||
framework.AddSuites(&framework.TestSuite{ | ||
Component: "Podman", | ||
CanRunLocal: true, | ||
Cases: []framework.TestCase{ | ||
new(PodmanTest), | ||
}, | ||
}) | ||
} | ||
|
||
func (tc *PodmanTest) BeforeAll(f *framework.F) { | ||
e2eutil.WaitForLeader(f.T(), tc.Nomad()) | ||
e2eutil.WaitForNodesReady(f.T(), tc.Nomad(), 2) | ||
} | ||
|
||
func (tc *PodmanTest) TestRedisDeployment(f *framework.F) { | ||
t := f.T() | ||
nomadClient := tc.Nomad() | ||
uuid := uuid.Generate() | ||
jobID := "deployment" + uuid[0:8] | ||
tc.jobIDs = append(tc.jobIDs, jobID) | ||
e2eutil.RegisterAndWaitForAllocs(t, nomadClient, "podman/input/redis.nomad", jobID, "") | ||
ds := e2eutil.DeploymentsForJob(t, nomadClient, jobID) | ||
require.Equal(t, 1, len(ds)) | ||
|
||
jobs := nomadClient.Jobs() | ||
allocs, _, err := jobs.Allocations(jobID, true, nil) | ||
require.NoError(t, err) | ||
|
||
var allocIDs []string | ||
for _, alloc := range allocs { | ||
allocIDs = append(allocIDs, alloc.ID) | ||
} | ||
|
||
// Wait for allocations to get past initial pending state | ||
e2eutil.WaitForAllocsNotPending(t, nomadClient, allocIDs) | ||
|
||
jobs = nomadClient.Jobs() | ||
allocs, _, err = jobs.Allocations(jobID, true, nil) | ||
require.NoError(t, err) | ||
|
||
require.Len(t, allocs, 1) | ||
require.Equal(t, allocs[0].ClientStatus, "running") | ||
} | ||
|
||
func (tc *PodmanTest) AfterEach(f *framework.F) { | ||
nomadClient := tc.Nomad() | ||
|
||
// Mark all nodes eligible | ||
nodesAPI := tc.Nomad().Nodes() | ||
nodes, _, _ := nodesAPI.List(nil) | ||
for _, node := range nodes { | ||
nodesAPI.ToggleEligibility(node.ID, true, nil) | ||
} | ||
|
||
jobs := nomadClient.Jobs() | ||
// Stop all jobs in test | ||
for _, id := range tc.jobIDs { | ||
jobs.Deregister(id, true, nil) | ||
} | ||
tc.jobIDs = []string{} | ||
// Garbage collect | ||
nomadClient.System().GarbageCollect() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.