@@ -1938,42 +1938,21 @@ mod tests {
1938
1938
mut instance : Instance ,
1939
1939
state : InstanceState ,
1940
1940
) -> Instance {
1941
- let new_runtime = model:: InstanceRuntimeState {
1942
- nexus_state : state,
1943
- gen : instance. runtime_state . gen . next ( ) . into ( ) ,
1944
- ..instance. runtime_state . clone ( )
1941
+ let propolis_id = match state {
1942
+ InstanceState :: Vmm => Some ( Uuid :: new_v4 ( ) ) ,
1943
+ _ => None ,
1945
1944
} ;
1946
- let res = db_datastore
1947
- . instance_update_runtime ( & instance. id ( ) , & new_runtime)
1948
- . await ;
1949
- assert ! ( matches!( res, Ok ( true ) ) , "Failed to change instance state" ) ;
1950
- instance. runtime_state = new_runtime;
1951
- instance
1952
- }
1953
1945
1954
- /// Sets or clears the active Propolis ID in the supplied instance record.
1955
- /// This can be used to exercise the "does this instance have an active
1956
- /// VMM?" test that determines in part whether an instance's network
1957
- /// interfaces can change.
1958
- ///
1959
- /// Note that this routine does not construct a VMM record for the
1960
- /// corresponding ID, so any functions that expect such a record to exist
1961
- /// will fail in strange and exciting ways.
1962
- async fn instance_set_active_vmm (
1963
- db_datastore : & DataStore ,
1964
- mut instance : Instance ,
1965
- propolis_id : Option < Uuid > ,
1966
- ) -> Instance {
1967
1946
let new_runtime = model:: InstanceRuntimeState {
1947
+ nexus_state : state,
1968
1948
propolis_id,
1969
1949
gen : instance. runtime_state . gen . next ( ) . into ( ) ,
1970
1950
..instance. runtime_state . clone ( )
1971
1951
} ;
1972
-
1973
1952
let res = db_datastore
1974
1953
. instance_update_runtime ( & instance. id ( ) , & new_runtime)
1975
1954
. await ;
1976
- assert ! ( matches!( res, Ok ( true ) ) , "Failed to change instance VMM ref " ) ;
1955
+ assert ! ( matches!( res, Ok ( true ) ) , "Failed to change instance state " ) ;
1977
1956
instance. runtime_state = new_runtime;
1978
1957
instance
1979
1958
}
@@ -2104,7 +2083,7 @@ mod tests {
2104
2083
}
2105
2084
2106
2085
async fn create_running_instance ( & self ) -> Instance {
2107
- let instance = instance_set_state (
2086
+ instance_set_state (
2108
2087
& self . db_datastore ,
2109
2088
create_instance (
2110
2089
& self . opctx ,
@@ -2114,13 +2093,6 @@ mod tests {
2114
2093
. await ,
2115
2094
InstanceState :: Vmm ,
2116
2095
)
2117
- . await ;
2118
-
2119
- instance_set_active_vmm (
2120
- & self . db_datastore ,
2121
- instance,
2122
- Some ( Uuid :: new_v4 ( ) ) ,
2123
- )
2124
2096
. await
2125
2097
}
2126
2098
}
0 commit comments