Get or initialize the shared test tables.
()
| 137 | |
| 138 | /// Get or initialize the shared test tables. |
| 139 | pub async fn tables() -> &'static TestTables { |
| 140 | TEST_TABLES |
| 141 | .get_or_init(|| async { |
| 142 | let c = client(); |
| 143 | let suffix = format!( |
| 144 | "_{}_{}", |
| 145 | std::time::SystemTime::now() |
| 146 | .duration_since(std::time::UNIX_EPOCH) |
| 147 | .unwrap() |
| 148 | .as_millis(), |
| 149 | COUNTER.fetch_add(1, Ordering::SeqCst) |
| 150 | ); |
| 151 | |
| 152 | let t = TestTables { |
| 153 | simple_key_string: format!("SimpleKeyString{suffix}"), |
| 154 | comp_key_string_number: format!("CompKeyStringNumber{suffix}"), |
| 155 | comp_key_blob_number: format!("CompKeyBlobNumber{suffix}"), |
| 156 | comp_key_number_string: format!("CompKeyNumberString{suffix}"), |
| 157 | simple_key_string_gsi: format!("SimpleKeyStringGSI{suffix}"), |
| 158 | comp_key_string_string_gsi: format!("CompKeyStringStringGSI{suffix}"), |
| 159 | }; |
| 160 | |
| 161 | create_table( |
| 162 | c, |
| 163 | &t.simple_key_string, |
| 164 | HASH_KEY_S, |
| 165 | ScalarAttributeType::S, |
| 166 | None, |
| 167 | None, |
| 168 | None, |
| 169 | ) |
| 170 | .await; |
| 171 | create_table( |
| 172 | c, |
| 173 | &t.comp_key_string_number, |
| 174 | HASH_KEY_S, |
| 175 | ScalarAttributeType::S, |
| 176 | Some(RANGE_KEY_N), |
| 177 | Some(ScalarAttributeType::N), |
| 178 | None, |
| 179 | ) |
| 180 | .await; |
| 181 | create_table( |
| 182 | c, |
| 183 | &t.comp_key_blob_number, |
| 184 | HASH_KEY_B, |
| 185 | ScalarAttributeType::B, |
| 186 | Some(RANGE_KEY_N), |
| 187 | Some(ScalarAttributeType::N), |
| 188 | None, |
| 189 | ) |
| 190 | .await; |
| 191 | create_table( |
| 192 | c, |
| 193 | &t.comp_key_number_string, |
| 194 | HASH_KEY_N, |
| 195 | ScalarAttributeType::N, |
| 196 | Some(RANGE_KEY_S), |
no test coverage detected