Skip to content

Commit

Permalink
Merge pull request #193 from ArangoGutierrez/devel/nvgha/ssh
Browse files Browse the repository at this point in the history
E2E Add integration test
  • Loading branch information
ArangoGutierrez authored Oct 18, 2024
2 parents 20a584f + 4ea3126 commit 3608104
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 44 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:
- release-*

jobs:
e2e-tests:
e2e-test:
runs-on: linux-amd64-cpu4
if: ${{ github.event.workflow_run.conclusion == 'success' }} && ${{ github.event.workflow_run.event == 'push' }}
steps:
Expand Down Expand Up @@ -58,3 +58,15 @@ jobs:
name: e2e-test-logs
path: ./e2e_logs/
retention-days: 15

integration-test:
runs-on: linux-amd64-cpu4
if: ${{ github.event.workflow_run.conclusion == 'success' }} && ${{ github.event.workflow_run.event == 'push' }}
steps:
- name: Set up Holodeck
uses: ./action.yml
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_ssh_key: ${{ secrets.AWS_SSH_KEY }}
holodeck_config: "tests/test_aws.yml"
23 changes: 0 additions & 23 deletions tests/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/NVIDIA/holodeck/internal/logger"
"github.com/NVIDIA/holodeck/pkg/jyaml"
"github.com/NVIDIA/holodeck/pkg/provider"
"github.com/NVIDIA/holodeck/pkg/provider/aws"
"github.com/NVIDIA/holodeck/pkg/provisioner"
"github.com/NVIDIA/holodeck/tests/common"
)
Expand Down Expand Up @@ -105,28 +104,6 @@ var _ = Describe("AWS", func() {
err = provider.Create()
Expect(err).ToNot(HaveOccurred())
})
It("Provisions the environment", func() {
var hostUrl string

// Read cache after creating the environment
cache, err := jyaml.UnmarshalFromFile[v1alpha1.Environment](opts.cachefile)
Expect(err).ToNot(HaveOccurred())

for _, p := range cache.Status.Properties {
if p.Name == aws.PublicDnsName {
hostUrl = p.Value
break
}
}

p, err := provisioner.New(log, opts.cfg.Spec.Auth.PrivateKey, opts.cfg.Spec.Username, hostUrl)
Expect(err).ToNot(HaveOccurred())

err = p.Run(opts.cfg)
Expect(err).ToNot(HaveOccurred())

p.Client.Close()
})
})
})
})
20 changes: 0 additions & 20 deletions tests/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,8 @@ func getTestEnv() {
Expect(err).NotTo(HaveOccurred())
}

func lockSShk() {
// look for env var set KEY
envSshKey := os.Getenv("AWS_SSH_KEY")
Expect(envSshKey).NotTo(BeEmpty())

err := os.MkdirAll("/home/runner/.cache", 0700)
Expect(err).NotTo(HaveOccurred())

err = os.WriteFile("/home/runner/.cache/key", []byte(envSshKey), 0600)
Expect(err).NotTo(HaveOccurred())
}

// BeforeSuite runs before the test suite
var _ = BeforeSuite(func() {
// Init
getTestEnv()
// Lock ssh key
lockSShk()
})

var _ = AfterSuite(func() {
// Cleanup
err := os.Remove("/home/runner/.cache/key")
Expect(err).NotTo(HaveOccurred())
})

0 comments on commit 3608104

Please sign in to comment.