Add e2e tests for exec env createOrUpdate
This also adds a Nomad client to the e2e_tests that can be used to query Nomad and validate that certain actions happened in Nomad correctly.
This commit is contained in:

committed by
Tobias Kantusch

parent
1be744f2d4
commit
1c4daa99a9
@@ -1,6 +1,7 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
nomadApi "github.com/hashicorp/nomad/api"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"gitlab.hpi.de/codeocean/codemoon/poseidon/config"
|
||||
"gitlab.hpi.de/codeocean/codemoon/poseidon/logging"
|
||||
@@ -15,7 +16,11 @@ import (
|
||||
* For the e2e tests a nomad cluster must be connected and poseidon must be running.
|
||||
*/
|
||||
|
||||
var log = logging.GetLogger("e2e")
|
||||
var (
|
||||
log = logging.GetLogger("e2e")
|
||||
nomadClient *nomadApi.Client
|
||||
nomadNamespace string
|
||||
)
|
||||
|
||||
type E2ETestSuite struct {
|
||||
suite.Suite
|
||||
@@ -35,7 +40,16 @@ func TestMain(m *testing.M) {
|
||||
log.Info("Test Setup")
|
||||
err := config.InitConfig()
|
||||
if err != nil {
|
||||
log.Warn("Could not initialize configuration")
|
||||
log.WithError(err).Fatal("Could not initialize configuration")
|
||||
}
|
||||
nomadNamespace = config.Config.Nomad.Namespace
|
||||
nomadClient, err = nomadApi.NewClient(&nomadApi.Config{
|
||||
Address: config.Config.NomadAPIURL().String(),
|
||||
TLSConfig: &nomadApi.TLSConfig{},
|
||||
Namespace: nomadNamespace,
|
||||
})
|
||||
if err != nil {
|
||||
log.WithError(err).Fatal("Could not create Nomad client")
|
||||
}
|
||||
// ToDo: Add Nomad job here when it is possible to create execution environments. See #26.
|
||||
log.Info("Test Run")
|
||||
|
Reference in New Issue
Block a user