Skip to content

Commit

Permalink
Shuffle run-e2e-test, remove TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
wongma7 committed Aug 13, 2019
1 parent 3063b1e commit 6d0a924
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
24 changes: 13 additions & 11 deletions hack/run-e2e-test
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -uo pipefail
set -euo pipefail

OS_ARCH=$(go env GOOS)-amd64
TEST_ID=$RANDOM
Expand All @@ -39,6 +39,15 @@ if [[ ! -e $KOPS_PATH ]]; then
chmod +x $KOPS_PATH
fi

# Push test driver image
eval $(aws ecr get-login --region $REGION --no-include-email)
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
IMAGE_TAG=$TEST_ID
IMAGE_NAME=$AWS_ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/aws-efs-csi-driver
docker build -t $IMAGE_NAME:$IMAGE_TAG .
docker push $IMAGE_NAME:$IMAGE_TAG

set +e
echo "Creating cluster $CLUSTER_NAME"
CLUSTER_YAML_PATH=$TEST_DIR/$CLUSTER_NAME.yaml
SSH_KEY_PATH=$TEST_DIR/id_rsa
Expand All @@ -50,9 +59,9 @@ $KOPS_PATH create cluster --state $KOPS_STATE_FILE \
--kubernetes-version=$K8S_VERSION \
--ssh-public-key=$SSH_KEY_PATH.pub \
$CLUSTER_NAME.k8s.local
$KOPS_PATH get cluster --state $KOPS_STATE_FILE $CLUSTER_NAME.k8s.local -o yaml > $CLUSTER_YAML_PATH
$KOPS_PATH replace --state $KOPS_STATE_FILE -f $CLUSTER_YAML_PATH
$KOPS_PATH update cluster --state $KOPS_STATE_FILE $CLUSTER_NAME.k8s.local --yes
$KOPS_PATH get cluster --state $KOPS_STATE_FILE $CLUSTER_NAME.k8s.local -o yaml > $CLUSTER_YAML_PATH
$KOPS_PATH replace --state $KOPS_STATE_FILE -f $CLUSTER_YAML_PATH
$KOPS_PATH update cluster --state $KOPS_STATE_FILE $CLUSTER_NAME.k8s.local --yes

# Wait for cluster creation
while [[ 1 ]]; do
Expand All @@ -66,13 +75,6 @@ while [[ 1 ]]; do
fi
done;

# Push test driver image
eval $(aws ecr get-login --region $REGION --no-include-email)
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
IMAGE_TAG=$TEST_ID
IMAGE_NAME=$AWS_ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/aws-efs-csi-driver
docker build -t $IMAGE_NAME:$IMAGE_TAG .
docker push $IMAGE_NAME:$IMAGE_TAG

echo "Deploying driver"
cat deploy/kubernetes/manifest.yaml | sed s,amazon/aws-efs-csi-driver:latest,$IMAGE_NAME:$IMAGE_TAG, > $TEST_DIR/manifest.yaml
Expand Down
15 changes: 1 addition & 14 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,28 +101,17 @@ func (e *efsDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTestConf
ginkgo.By("Deploying EFS CSI driver")
cancelPodLogs := testsuites.StartPodLogs(f)

/* TODO deploy the driver before the test.
cleanup, err := f.CreateFromManifests(nil, "deploy/kubernetes/manifest.yaml")
if err != nil {
framework.Failf("Error deploying EFS CSI driver: %v", err)
}
*/

return &testsuites.PerTestConfig{
Driver: e,
Prefix: "efs",
Framework: f,
}, func() {
ginkgo.By("Cleaning up EFS CSI driver")
/* TODO deploy the driver before the test.
cleanup()
*/
cancelPodLogs()
}
}

func (e *efsDriver) CreateVolume(config *testsuites.PerTestConfig, volType testpatterns.TestVolType) testsuites.TestVolume {
// TODO it's assumed that the EFS volumeHandle referred to in GetPersistentVolumeSource already exists. Instead, it could be dynamically created per test here?
return nil
}

Expand All @@ -131,8 +120,6 @@ func (e *efsDriver) GetPersistentVolumeSource(readOnly bool, fsType string, volu
CSI: &v1.CSIPersistentVolumeSource{
Driver: e.driverInfo.Name,
VolumeHandle: *fileSystemID,
// TODO isolate e2e test files to a path?
// VolumeAttributes: map[string]string{"path": "/e2e"},
},
}
return &pvSource, nil
Expand All @@ -151,7 +138,7 @@ var csiTestSuites = []func() testsuites.TestSuite{

var _ = ginkgo.Describe("[efs-csi] EFS CSI", func() {
driver := InitEFSCSIDriver()
ginkgo.Context(testsuites.GetDriverNameWithFeatureTags(InitEFSCSIDriver()), func() {
ginkgo.Context(testsuites.GetDriverNameWithFeatureTags(driver), func() {
testsuites.DefineTestSuite(driver, csiTestSuites)
})
})

0 comments on commit 6d0a924

Please sign in to comment.