From ec0eca2967d7ec274dfeef89e1a5c1733fea637d Mon Sep 17 00:00:00 2001 From: ddeidda Date: Fri, 18 Sep 2020 13:38:54 +0200 Subject: [PATCH] Add integration test for cluster creation in private subnet Signed-off-by: ddeidda --- .../networking/test_cluster_networking.py | 26 +++++++++++++++++++ .../pcluster.config.ini | 23 ++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 tests/integration-tests/tests/networking/test_cluster_networking.py create mode 100644 tests/integration-tests/tests/networking/test_cluster_networking/test_cluster_in_private_subnet/pcluster.config.ini diff --git a/tests/integration-tests/tests/networking/test_cluster_networking.py b/tests/integration-tests/tests/networking/test_cluster_networking.py new file mode 100644 index 0000000000..c3436a761d --- /dev/null +++ b/tests/integration-tests/tests/networking/test_cluster_networking.py @@ -0,0 +1,26 @@ +# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. +import pytest +from assertpy import assert_that +from utils import get_compute_nodes_instance_ids + + +@pytest.mark.dimensions("us-west-2", "c5.xlarge", "alinux2", "slurm") +@pytest.mark.dimensions("eu-west-2", "c5.xlarge", "centos7", "sge") +@pytest.mark.usefixtures("os", "scheduler", "instance") +def test_cluster_in_private_subnet(region, pcluster_config_reader, clusters_factory): + # This test just creates a cluster in the private subnet and just checks that no failures occur + cluster_config = pcluster_config_reader() + cluster = clusters_factory(cluster_config) + assert_that(cluster).is_not_none() + + assert_that(len(get_compute_nodes_instance_ids(cluster.cfn_name, region))).is_equal_to(1) diff --git a/tests/integration-tests/tests/networking/test_cluster_networking/test_cluster_in_private_subnet/pcluster.config.ini b/tests/integration-tests/tests/networking/test_cluster_networking/test_cluster_in_private_subnet/pcluster.config.ini new file mode 100644 index 0000000000..3adf73b88a --- /dev/null +++ b/tests/integration-tests/tests/networking/test_cluster_networking/test_cluster_in_private_subnet/pcluster.config.ini @@ -0,0 +1,23 @@ +[global] +cluster_template = default + +[aws] +aws_region_name = {{ region }} + +[cluster default] +base_os = {{ os }} +key_name = {{ key_name }} +vpc_settings = parallelcluster-vpc +scheduler = {{ scheduler }} +master_instance_type = {{ instance }} +compute_instance_type = {{ instance }} +initial_queue_size = 1 +max_queue_size = 1 +maintain_initial_size = false + + +[vpc parallelcluster-vpc] +vpc_id = {{ vpc_id }} +master_subnet_id = {{ private_subnet_id }} +compute_subnet_id = {{ private_subnet_id }} +use_public_ips=false \ No newline at end of file