@@ -1642,7 +1642,11 @@ mod tests {
1642
1642
"couldn't send SledInstanceState to test driver" ,
1643
1643
)
1644
1644
} ) ?;
1645
- todo ! ( )
1645
+ self . nexus_disposition
1646
+ . borrow ( )
1647
+ . as_ref ( )
1648
+ . cloned ( )
1649
+ . ok_or ( omicron_common:: api:: external:: Error :: unavail ( "did not set nexus_disposition in FakeNexusServer" ) )
1646
1650
}
1647
1651
1648
1652
fn cpapi_handle_instance_put_failure (
@@ -1660,7 +1664,11 @@ mod tests {
1660
1664
"couldn't send error to test driver" ,
1661
1665
)
1662
1666
} ) ?;
1663
- todo ! ( )
1667
+ self . nexus_disposition
1668
+ . borrow ( )
1669
+ . as_ref ( )
1670
+ . cloned ( )
1671
+ . ok_or ( omicron_common:: api:: external:: Error :: unavail ( "did not set nexus_disposition in FakeNexusServer" ) )
1664
1672
}
1665
1673
}
1666
1674
@@ -1953,9 +1961,12 @@ mod tests {
1953
1961
let _mock_vnic_contexts = mock_vnic_contexts ( ) ;
1954
1962
let _mock_zone_contexts = mock_zone_contexts ( ) ;
1955
1963
1956
- let FakeNexusParts { nexus_client, nexus_server, mut state_rx, .. } =
1964
+ let FakeNexusParts { nexus_client, nexus_server, mut state_rx, disp_tx } =
1957
1965
FakeNexusParts :: new ( & logctx) ;
1958
1966
1967
+ disp_tx. send ( Some ( HandleInstancePutResultResult :: Ok ) )
1968
+ . expect ( "couldn't send nexus_disposition" ) ;
1969
+
1959
1970
let ( _dns_server, resolver, _dns_config_dir) =
1960
1971
timeout ( TIMEOUT_DURATION , dns_server ( & logctx, & nexus_server) )
1961
1972
. await
@@ -1978,13 +1989,17 @@ mod tests {
1978
1989
. await
1979
1990
. expect ( "timed out creating Instance struct" ) ;
1980
1991
1981
- timeout (
1982
- TIMEOUT_DURATION ,
1983
- inst. put_state ( InstanceStateRequested :: Running ) ,
1984
- )
1985
- . await
1986
- . expect ( "timed out waiting for Instance::put_state" )
1987
- . unwrap ( ) ;
1992
+ let ( put_tx, put_rx) = oneshot:: channel ( ) ;
1993
+
1994
+ inst. put_state ( put_tx, InstanceStateRequested :: Running )
1995
+ . await
1996
+ . expect ( "failed to send Instance::put_state" ) ;
1997
+
1998
+ timeout ( TIMEOUT_DURATION , put_rx)
1999
+ . await
2000
+ . expect ( "timed out waiting for Instance::put_state result" )
2001
+ . expect ( "failed to receive Instance::put_state result" )
2002
+ . expect ( "Instance::put_state failed" ) ;
1988
2003
1989
2004
timeout (
1990
2005
TIMEOUT_DURATION ,
@@ -1997,7 +2012,7 @@ mod tests {
1997
2012
)
1998
2013
. await
1999
2014
. expect ( "timed out waiting for InstanceState::Running in FakeNexus" )
2000
- . unwrap ( ) ;
2015
+ . expect ( "failed to receive FakeNexus' InstanceState" ) ;
2001
2016
2002
2017
logctx. cleanup_successful ( ) ;
2003
2018
}
@@ -2013,9 +2028,12 @@ mod tests {
2013
2028
let _mock_vnic_contexts = mock_vnic_contexts ( ) ;
2014
2029
let _mock_zone_contexts = mock_zone_contexts ( ) ;
2015
2030
2016
- let FakeNexusParts { nexus_client, nexus_server, state_rx, .. } =
2031
+ let FakeNexusParts { nexus_client, nexus_server, state_rx, disp_tx } =
2017
2032
FakeNexusParts :: new ( & logctx) ;
2018
2033
2034
+ disp_tx. send ( Some ( HandleInstancePutResultResult :: Ok ) )
2035
+ . expect ( "couldn't send nexus_disposition" ) ;
2036
+
2019
2037
let ( _dns_server, resolver, _dns_config_dir) =
2020
2038
timeout ( TIMEOUT_DURATION , dns_server ( & logctx, & nexus_server) )
2021
2039
. await
@@ -2039,7 +2057,13 @@ mod tests {
2039
2057
. await
2040
2058
. expect ( "timed out creating Instance struct" ) ;
2041
2059
2042
- timeout ( TIMEOUT_DURATION , inst. put_state ( InstanceStateRequested :: Running ) )
2060
+ let ( put_tx, put_rx) = oneshot:: channel ( ) ;
2061
+
2062
+ inst. put_state ( put_tx, InstanceStateRequested :: Running )
2063
+ . await
2064
+ . expect ( "failed to send Instance::put_state" ) ;
2065
+
2066
+ timeout ( TIMEOUT_DURATION , put_rx)
2043
2067
. await
2044
2068
. expect_err ( "*should've* timed out waiting for Instance::put_state, but didn't?" ) ;
2045
2069
@@ -2076,9 +2100,14 @@ mod tests {
2076
2100
let halt_rm_ctx = MockZones :: halt_and_remove_logged_context ( ) ;
2077
2101
halt_rm_ctx. expect ( ) . times ( ..) . returning ( |_, _| Ok ( ( ) ) ) ;
2078
2102
2079
- let FakeNexusParts { nexus_client, nexus_server, state_rx, .. } =
2103
+ let FakeNexusParts { nexus_client, nexus_server, state_rx, disp_tx } =
2080
2104
FakeNexusParts :: new ( & logctx) ;
2081
2105
2106
+ disp_tx. send ( Some ( HandleInstancePutResultResult :: TimedOut {
2107
+ generation : Generation ( 5 )
2108
+ } ) )
2109
+ . expect ( "couldn't send nexus_disposition" ) ;
2110
+
2082
2111
let ( _dns_server, resolver, _dns_config_dir) =
2083
2112
timeout ( TIMEOUT_DURATION , dns_server ( & logctx, & nexus_server) )
2084
2113
. await
@@ -2102,7 +2131,13 @@ mod tests {
2102
2131
. await
2103
2132
. expect ( "timed out creating Instance struct" ) ;
2104
2133
2105
- timeout ( TIMEOUT_DURATION , inst. put_state ( InstanceStateRequested :: Running ) )
2134
+ let ( put_tx, put_rx) = oneshot:: channel ( ) ;
2135
+
2136
+ inst. put_state ( put_tx, InstanceStateRequested :: Running )
2137
+ . await
2138
+ . expect ( "failed to send Instance::put_state" ) ;
2139
+
2140
+ timeout ( TIMEOUT_DURATION , put_rx)
2106
2141
. await
2107
2142
. expect_err ( "*should've* timed out waiting for Instance::put_state, but didn't?" ) ;
2108
2143
0 commit comments