@@ -28,73 +28,6 @@ def stack_name(self):
2828 """Generate a unique stack name for testing."""
2929 return f"hyperpod-test-stack-{ str (uuid .uuid4 ())[:8 ]} "
3030
31- def test_create_stack (self , stack_name ):
32- """Test creating a CloudFormation stack using HpClusterStack."""
33- # Create a minimal stack configuration
34- cluster_stack = HpClusterStack (
35- stage = "gamma" ,
36- resource_name_prefix = f"hyperpod-test-{ str (uuid .uuid4 ())[:8 ]} " ,
37- eks_cluster_name = "test-eks-cluster" ,
38- create_eks_cluster_stack = True ,
39- create_vpc_stack = False ,
40- create_private_subnet_stack = False ,
41- create_security_group_stack = False ,
42- create_s3_bucket_stack = True ,
43- create_s3_endpoint_stack = False ,
44- create_life_cycle_script_stack = False ,
45- create_sagemaker_iam_role_stack = False ,
46- create_helm_chart_stack = False ,
47- create_hyperpod_cluster_stack = False ,
48- create_fsx_stack = False ,
49- )
50-
51- cf_client = create_boto3_client ('cloudformation' )
52- stack_exists = False
53-
54- try :
55- # Create the stack (Did not need the name of the stack so fixed this.)
56- cluster_stack .create (region = "us-west-2" )
57-
58- # Wait for stack to be created (with timeout)
59- # max_attempts = 10
60- # for attempt in range(max_attempts):
61- # try:
62- # response = cf_client.describe_stacks(StackName=stack_name)
63- # stack_exists = True
64- # print(f"Stack found after {attempt + 1} attempts")
65- # break
66- # except Exception as e:
67- # if "does not exist" in str(e):
68- # print(f"Waiting for stack to be created (attempt {attempt + 1}/{max_attempts})")
69- # time.sleep(3) # Wait before retrying
70- # else:
71- # raise
72-
73- # # Verify the stack was created
74- # assert stack_exists, f"Stack {stack_name} was not created within the timeout period"
75- #
76- # # Get the latest stack information
77- # response = cf_client.describe_stacks(StackName=stack_name)
78- # assert len(response['Stacks']) == 1
79- # assert response['Stacks'][0]['StackName'] == stack_name
80- # assert response['Stacks'][0]['StackStatus'] in [
81- # 'CREATE_IN_PROGRESS',
82- # 'CREATE_COMPLETE'
83- # ]
84- #
85- # # Verify tags were applied
86- # stack_tags = response['Stacks'][0]['Tags']
87- # assert any(tag['Key'] == 'Environment' and tag['Value'] == 'Test' for tag in stack_tags)
88- # assert any(tag['Key'] == 'Project' and tag['Value'] == 'HyperPod' for tag in stack_tags)
89- #
90- finally :
91- # Clean up - delete the stack if it exists
92- if stack_exists :
93- try :
94- cf_client .delete_stack (StackName = stack_name )
95- print (f"Stack { stack_name } deletion initiated" )
96- except Exception as e :
97- print (f"Error deleting stack: { e } " )
9831
9932 @pytest .mark .dependency (name = "list_stacks" )
10033 def test_list_stacks (self ):
0 commit comments