-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 in RABSW/nnf-sos from feature/test to master
Squashed commit of the following: commit 1b144fd8546d29a61fa7f2df911323663e5b1b8d Author: Bill Johnson <[email protected]> Date: Mon Sep 13 13:01:54 2021 -0500 RABSW-514: Removed comment block in SetupReconciler commit 898537dcf67d581896da5387bc4d64b825f6427f Author: Bill Johnson <[email protected]> Date: Mon Sep 13 08:24:47 2021 -0500 RABSW-514: Removed redundant WORKSPACE from testing stage commit 6297579ebb758b3c3c868d7387008d539b9f913f Author: Bill Johnson <[email protected]> Date: Fri Sep 10 15:11:41 2021 -0500 RABSW-514: Refactored Dockerfile according to pull request feedback commit 5c7a58bfd023f10c7c3773675894d29ffac0a0f7 Author: Bill Johnson <[email protected]> Date: Thu Sep 9 17:28:26 2021 -0500 RABSW-514: Removed cobertura stuff as it's not used by jenkins and is fighting with vendoring commit 9e338220a35199dbf39feb876b0afcc28b1dc15c Author: Bill Johnson <[email protected]> Date: Thu Sep 9 16:46:21 2021 -0500 RABSW-514: Fixed production stage in Dockerfile to run successfully commit 99f5602b00e2ef11a1d3c645a8ffa4e353d824a0 Author: Bill Johnson <[email protected]> Date: Thu Sep 9 13:50:14 2021 -0500 RABSW-514: Reduced the number of RUN statements in Dockerfile commit 3ea46aca8572edb728b13a1596cf9e6df3088157 Merge: 5329885 c4731c3 Author: Bill Johnson <[email protected]> Date: Thu Sep 9 13:08:12 2021 -0500 Merged master, refactored Dockerfile for lustre and unit tests commit 5329885be9e3334d21dd8a9d92ca97355496edb2 Author: Bill Johnson <[email protected]> Date: Wed Sep 8 13:21:02 2021 -0500 Cleaned up dockerfile, added 2 run scripts commit 87c89d2ee8ec4d67b1e7b51126b7713c8f6792b3 Author: Bill Johnson <[email protected]> Date: Thu Aug 26 15:26:47 2021 -0500 RABSW-514: Fixed bad .dwsoperator branch in .gitmodules commit 06458342c99480101db97c6e5c59cac404f87f9e Author: Nate Roiger <[email protected]> Date: Thu Aug 12 07:48:19 2021 -0500 Initial round of integration testing
- Loading branch information
Bill Johnson
committed
Sep 13, 2021
1 parent
c4731c3
commit f9acbb1
Showing
16 changed files
with
454 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
!**/*.go | ||
!**/*.mod | ||
!**/*.sum | ||
Dockerfile | ||
.git | ||
.vscode |
Submodule .dws-operator
added at
c4948d
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,4 @@ | ||
[submodule ".dws-operator"] | ||
path = .dws-operator | ||
url = ssh://[email protected]:7999/dpm/dws-operator | ||
branch = master |
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,20 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Test Package", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "test", | ||
"program": "${workspaceFolder}", | ||
"args": ["./..."], | ||
"env": { | ||
"KUBEBUILDER_ASSETS": "${workspaceFolder}/testbin/bin" | ||
}, | ||
|
||
} | ||
] | ||
} |
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,16 @@ | ||
// Procedure for building NNF Element Controller | ||
|
||
@Library('dst-shared@master') _ | ||
|
||
dockerBuildPipeline { | ||
repository = "cray" | ||
imagePrefix = "cray" | ||
app = "dp-nnf-sos" | ||
name = "dp-nnf-sos" | ||
description = "Near Node Flash Storage Orchestration Services" | ||
dockerfile = "Dockerfile" | ||
useLazyDocker = true | ||
autoJira = false | ||
createSDPManifest = false | ||
product = "kj" | ||
} |
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,22 @@ | ||
# NNF Storage Orchestration Services (SOS) | ||
|
||
The NNF SOS project is a collection of Kubernetes Custom Resource Definitions (CRDs) and associated controllers that permit the creation, management, and destruction of storage on an NNF cluster. | ||
|
||
## Setup | ||
|
||
This project depends on additional CRDs present in the dws-operator project. It makes use of `git submodules` to make the dependecy in version control. To clone this project, use the additional `--recurse-submodules` option. | ||
``` | ||
git clone --recurse-submodules ssh://[email protected]:7999/rabsw/nnf-sos.git | ||
``` | ||
|
||
If you've already clone the repo, initialize the submodules with `git submodule init` | ||
|
||
## Building | ||
|
||
Run `make` | ||
|
||
## Testing | ||
|
||
Run `make test`. This ensures the proper utilities (kube-apiserver, kubectl, etcd) are installed in the `./testbin` directory | ||
|
||
If you use VS Code, the Test Package configuration exists to start a live debugger of the test suite. |
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,102 @@ | ||
/* | ||
Copyright 2021 Hewlett Packard Enterprise Development LP | ||
*/ | ||
|
||
package controllers | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"strings" | ||
"time" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
nnfv1alpha1 "stash.us.cray.com/RABSW/nnf-sos/api/v1alpha1" | ||
dwsv1alpha1 "stash.us.cray.com/dpm/dws-operator/api/v1alpha1" | ||
) | ||
|
||
var _ = Describe("Integration Test", func() { | ||
|
||
const ( | ||
WorkflowName = "test-workflow" | ||
WorkflowNamespace = "default" | ||
WorkflowID = "test" | ||
) | ||
|
||
const timeout = time.Second * 10 | ||
const interval = time.Second * 1 | ||
|
||
Describe("Creating a Workflow Resource", func() { | ||
|
||
for _, fs := range []string{"raw", "lvm", "xfs", "gfs2", "lustre"} { | ||
|
||
// TODO: Remove this as more file systems are supported and tested | ||
BeforeEach(func() { | ||
if fs != "raw" { | ||
Skip("File System Not Supported") | ||
} | ||
}) | ||
|
||
Context(fmt.Sprintf("%s File System", strings.ToTitle(fs)), func() { | ||
|
||
var workflow *dwsv1alpha1.Workflow | ||
var storage *nnfv1alpha1.NnfStorage | ||
|
||
It("Should create successfully", func() { | ||
workflow = &dwsv1alpha1.Workflow{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: WorkflowName, | ||
Namespace: WorkflowNamespace, | ||
}, | ||
Spec: dwsv1alpha1.WorkflowSpec{ | ||
DesiredState: "proposal", // TODO: This should be defined somewhere | ||
WLMID: WorkflowID, | ||
DWDirectives: []string{ | ||
fmt.Sprintf("#DW name=test filesystem=%s capacity=10GB", fs), // TODO: Should be a MakeDW method | ||
}, | ||
}, | ||
} | ||
|
||
Expect(k8sClient.Create(context.Background(), workflow)).Should(Succeed()) | ||
}) | ||
|
||
It("Should reach ready status and proposed state", func() { | ||
Eventually(func() bool { | ||
k8sClient.Get(context.Background(), types.NamespacedName{Name: WorkflowName, Namespace: WorkflowNamespace}, workflow) | ||
return workflow.Status.Ready | ||
}, timeout, interval).Should(BeTrue()) | ||
|
||
Expect(workflow.Status.State).Should(Equal("proposal")) | ||
}) | ||
|
||
PIt("Should have a single DW breakdown", func() { | ||
Expect(workflow.Status.DWDirectiveBreakdowns).Should(HaveLen(1)) | ||
}) | ||
|
||
PIt("Should have a NNF Storage reference in the DW breakdown", func() { | ||
//TODO | ||
}) | ||
|
||
PIt("Should have created the storage allocation", func() { | ||
err := k8sClient.Get(context.Background(), types.NamespacedName{Name: "", Namespace: ""}, storage) | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
}) | ||
|
||
PContext("Assigning NNF Node Names to NNF Storage", func() { | ||
|
||
var nodes *nnfv1alpha1.NnfNodeList | ||
It("Should find NNF Nodes", func() { | ||
err := k8sClient.List(context.Background(), nodes, &client.ListOptions{}) | ||
Expect(err).ShouldNot(HaveOccurred()) | ||
}) | ||
|
||
}) | ||
}) | ||
} | ||
}) | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
CWD=`pwd` | ||
echo "Running in $CWD, setting up envtest" | ||
|
||
export ENVTEST_ASSETS_DIR=/nnf/testbin | ||
mkdir -p ${ENVTEST_ASSETS_DIR} | ||
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.2/hack/setup-envtest.sh | ||
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh | ||
fetch_envtest_tools ${ENVTEST_ASSETS_DIR} | ||
setup_envtest_env ${ENVTEST_ASSETS_DIR} | ||
|
||
echo Running unit tests | ||
|
||
go test ./... -coverprofile cover.out > results.txt | ||
cat results.txt | ||
|
||
grep FAIL results.txt && echo "Unit tests failure" && rm results.txt && exit 1 | ||
|
||
echo "Unit tests successful" && rm results.txt | ||
|
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,8 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2021 Hewlett Packard Enterprise Development LP | ||
|
||
# This is a magic file, whos presence is an idication to DST pipeline that | ||
# this repository should be running tests. | ||
|
||
make docker-test |
Oops, something went wrong.