@@ -89,33 +89,59 @@ struct QemuPlatformDetail : public Test
8989 QString bridge_name;
9090 std::string hw_addr;
9191 mp::Subnet subnet;
92+ std::string iface_cidr;
93+ std::string broadcast_addr;
9294 std::string name;
9395 mutable std::unique_ptr<multipass::test::MockFirewallConfig> mock_firewall_config;
9496
9597 Switch (const QString& bridge_name,
9698 const std::string& hw_addr,
9799 const mp::Subnet& subnet,
100+ const std::string& iface_cidr,
101+ const std::string& broadcast_addr,
98102 const std::string& name)
99103 : bridge_name(bridge_name),
100104 hw_addr (hw_addr),
101105 subnet(subnet),
106+ iface_cidr(iface_cidr),
107+ broadcast_addr(broadcast_addr),
102108 name(name),
103109 mock_firewall_config(std::make_unique<mpt::MockFirewallConfig>())
104110 {
105111 }
106112
107113 Switch (const Switch& other)
108- : Switch(other.bridge_name, other.hw_addr, other.subnet, other.name)
114+ : Switch(other.bridge_name,
115+ other.hw_addr,
116+ other.subnet,
117+ other.iface_cidr,
118+ other.broadcast_addr,
119+ other.name)
109120 {
110121 }
111122 };
112123
113124 static inline const mp::Subnet zone1_subnet{" 192.168.64.0/24" };
114125 static inline const mp::Subnet zone2_subnet{" 192.168.96.0/24" };
115126 static inline const mp::Subnet zone3_subnet{" 192.168.128.0/24" };
116- const std::vector<Switch> switches{{" mpqemubrzone1" , " 52:54:00:6f:29:7e" , zone1_subnet, " foo" },
117- {" mpqemubrzone2" , " 52:54:00:6f:29:7f" , zone2_subnet, " bar" },
118- {" mpqemubrzone3" , " 52:54:00:6f:29:80" , zone3_subnet, " baz" }};
127+ const std::vector<Switch> switches{{" mpqemubrzone1" ,
128+ " 52:54:00:6f:29:7e" ,
129+ zone1_subnet,
130+ " 192.168.64.1/24" ,
131+ " 192.168.64.255" ,
132+ " foo" },
133+ {" mpqemubrzone2" ,
134+ " 52:54:00:6f:29:7f" ,
135+ zone2_subnet,
136+ " 192.168.96.1/24" ,
137+ " 192.168.96.255" ,
138+ " bar" },
139+ {" mpqemubrzone3" ,
140+ " 52:54:00:6f:29:80" ,
141+ zone3_subnet,
142+ " 192.168.128.1/24" ,
143+ " 192.168.128.255" ,
144+ " baz" }};
119145
120146 mpt::MockAvailabilityZone mock_zone1;
121147 mpt::MockAvailabilityZone mock_zone2;
@@ -152,9 +178,6 @@ TEST_F(QemuPlatformDetail, ctorSetsUpExpectedVirtualSwitches)
152178{
153179 for (const auto & vswitch : switches)
154180 {
155- const auto subnet{vswitch.subnet .to_cidr ()};
156- const auto broadcast = vswitch.subnet .broadcast_address ().as_string ();
157-
158181 EXPECT_CALL (*mock_utils,
159182 run_cmd_for_status (QString (" ip" ),
160183 ElementsAre (QString (" link" ),
@@ -170,11 +193,11 @@ TEST_F(QemuPlatformDetail, ctorSetsUpExpectedVirtualSwitches)
170193 run_cmd_for_status (QString (" ip" ),
171194 ElementsAre (QString (" address" ),
172195 QString (" add" ),
173- QString::fromStdString (subnet ),
196+ QString::fromStdString (vswitch. iface_cidr ),
174197 QString (" dev" ),
175198 vswitch.bridge_name ,
176199 " broadcast" ,
177- QString::fromStdString (broadcast )),
200+ QString::fromStdString (vswitch. broadcast_addr )),
178201 _))
179202 .WillOnce (Return (true ));
180203
0 commit comments