@@ -20,34 +20,21 @@ def load_yaml_file(file_path):
2020 return yaml .safe_load (f )
2121
2222
23- def test_scaleway_main_uses_project_parameter ():
24- """Test that main.yml uses 'project' instead of deprecated 'organization' parameter """
23+ def test_scaleway_main_uses_organization_parameter ():
24+ """Test that main.yml uses 'organization' parameter (custom module, not community.general) """
2525 main_yml = Path ("roles/cloud-scaleway/tasks/main.yml" )
2626 assert main_yml .exists (), "Scaleway main.yml not found"
2727
2828 with open (main_yml ) as f :
2929 content = f .read ()
3030
31- # Should NOT use the broken scaleway_organization_info module
32- assert "scaleway_organization_info" not in content , (
33- "Still using broken scaleway_organization_info module (issue #14846)"
34- )
35-
36- # Should NOT use the broken scaleway_image_info module
31+ assert "scaleway_organization_info" not in content , "Still using broken scaleway_organization_info module"
3732 assert "scaleway_image_info" not in content , "Still using broken scaleway_image_info module"
38-
39- # Should use project parameter (modern approach)
40- assert "project:" in content , "Missing 'project:' parameter in scaleway_compute calls"
33+ assert "organization:" in content , "Missing 'organization:' parameter in scaleway_compute calls"
4134 assert "algo_scaleway_org_id" in content , "Missing algo_scaleway_org_id variable reference"
35+ assert "project:" not in content , "Using unsupported 'project' parameter (not in custom module)"
4236
43- # Should NOT use deprecated organization parameter
44- assert 'organization: "{{' not in content , "Still using deprecated 'organization' parameter"
45-
46- # Should use Marketplace API v2 for image lookup
47- assert "api.scaleway.com/marketplace/v2" in content , "Not using Scaleway Marketplace API v2 for image lookup"
48- assert "api-marketplace.scaleway.com" not in content , "Still using deprecated api-marketplace.scaleway.com domain"
49-
50- print ("✓ Scaleway main.yml uses modern 'project' parameter" )
37+ print ("✓ Scaleway main.yml uses 'organization' parameter" )
5138
5239
5340def test_scaleway_prompts_collect_org_id ():
@@ -93,31 +80,26 @@ def test_scaleway_config_has_valid_settings():
9380
9481
9582def test_scaleway_marketplace_api_usage ():
96- """Test that the role correctly uses Scaleway Marketplace API v2"""
83+ """Test that the role correctly uses Scaleway Marketplace API v2 for image lookup """
9784 main_yml = Path ("roles/cloud-scaleway/tasks/main.yml" )
9885
9986 with open (main_yml ) as f :
10087 content = f .read ()
10188
102- # Should use uri module to fetch from Marketplace API v2
10389 assert "uri:" in content , "Not using uri module for API calls"
104-
105- # Should use local-images endpoint with image_label
90+ assert "marketplace/v2" in content , "Not using Marketplace API v2"
10691 assert "local-images" in content , "Not using local-images endpoint"
10792 assert "image_label" in content , "Not using image_label parameter"
108-
109- # Should filter for instance_local type
11093 assert "instance_local" in content , "Not filtering for instance_local image type"
111-
112- # Should set scaleway_image_id variable
11394 assert "scaleway_image_id" in content , "Missing scaleway_image_id variable for image UUID"
95+ assert "instance/v1" not in content , "Still using Instance API v1 for image lookup"
11496
11597 print ("✓ Scaleway role uses Marketplace API v2 correctly" )
11698
11799
118100if __name__ == "__main__" :
119101 tests = [
120- test_scaleway_main_uses_project_parameter ,
102+ test_scaleway_main_uses_organization_parameter ,
121103 test_scaleway_prompts_collect_org_id ,
122104 test_scaleway_config_has_valid_settings ,
123105 test_scaleway_marketplace_api_usage ,
0 commit comments