File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ def disks(self) -> List[AttachedDisk]:
92
92
@property
93
93
def network_interfaces (self ) -> List [NetworkInterface ]:
94
94
network_interface : NetworkInterface = NetworkInterface (
95
- network = self .instance_config .network ,
95
+ subnetwork = f"projects/ { self .config . project_id } /regions/ { self . config . region } /subnetworks/ { self . instance_config .subnetwork } " ,
96
96
)
97
97
if self .instance_config .enable_external_ip :
98
98
network_interface .access_configs = [
Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ class GCPConfig(BackendConfig):
94
94
95
95
project_id : str
96
96
zone : str
97
+ region : str = "europe-west1"
97
98
service_account_email : str = "default"
98
99
google_application_credentials : Optional [str ] = None
99
100
@@ -102,7 +103,7 @@ class GCPInstanceConfig(InstanceConfig):
102
103
image_family : str = "ubuntu-2004-lts"
103
104
image_project : str = "ubuntu-os-cloud"
104
105
machine_type : str = "e2-small"
105
- network : str = "global/networks/ default"
106
+ subnetwork : str = "default"
106
107
enable_nested_virtualization : bool = True
107
108
enable_external_ip : bool = True
108
109
spot : bool = False
Original file line number Diff line number Diff line change 15
15
def gcp_group (settings , monkeypatch ) -> RunnerGroup :
16
16
config = GCPConfig (
17
17
project_id = os .environ .get ("CLOUDSDK_CORE_PROJECT" , "" ),
18
+ region = os .environ .get ("CLOUDSDK_COMPUTE_REGION" , "" ),
18
19
zone = os .environ .get ("CLOUDSDK_COMPUTE_ZONE" , "" ),
19
20
google_application_credentials = os .environ .get (
20
21
"GOOGLE_APPLICATION_CREDENTIALS" , ""
@@ -55,8 +56,9 @@ def gcp_runner(runner: Runner, gcp_group: RunnerGroup) -> Runner:
55
56
56
57
57
58
def test_gcp_network_interfaces (gcp_group : RunnerGroup ):
58
- interfaces = gcp_group .backend .network_interfaces
59
+ interfaces : List [ NetworkInterface ] = gcp_group .backend .network_interfaces
59
60
assert len (interfaces ) == 1
61
+ assert "default" in gcp_group .backend .network_interfaces [0 ].subnetwork
60
62
assert interfaces [0 ].access_configs [0 ].name == "External NAT"
61
63
# Test disabling external IP
62
64
gcp_group .backend .instance_config .enable_external_ip = False
You can’t perform that action at this time.
0 commit comments