|
| 1 | +// Copyright 2023 Datafuse Labs. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +use chrono::DateTime; |
| 16 | +use chrono::Utc; |
| 17 | +use databend_common_meta_app::schema as mt; |
| 18 | +use fastrace::func_name; |
| 19 | + |
| 20 | +use crate::common; |
| 21 | + |
| 22 | +#[test] |
| 23 | +fn test_decode_v132_remove_sequence_meta_step() -> anyhow::Result<()> { |
| 24 | + let sequence_meta_v132 = vec![ |
| 25 | + 10, 23, 49, 57, 55, 48, 45, 48, 49, 45, 48, 49, 32, 48, 50, 58, 53, 49, 58, 48, 55, 32, 85, |
| 26 | + 84, 67, 18, 23, 49, 57, 55, 48, 45, 48, 49, 45, 48, 49, 32, 48, 50, 58, 53, 49, 58, 48, 55, |
| 27 | + 32, 85, 84, 67, 26, 3, 115, 101, 113, 40, 5, 48, 10, 160, 6, 132, 1, 168, 6, 24, |
| 28 | + ]; |
| 29 | + |
| 30 | + let want = || mt::SequenceMeta { |
| 31 | + create_on: DateTime::<Utc>::from_timestamp(10267, 0).unwrap(), |
| 32 | + update_on: DateTime::<Utc>::from_timestamp(10267, 0).unwrap(), |
| 33 | + comment: Some("seq".to_string()), |
| 34 | + step: 5, |
| 35 | + current: 10, |
| 36 | + }; |
| 37 | + common::test_pb_from_to(func_name!(), want())?; |
| 38 | + common::test_load_old(func_name!(), sequence_meta_v132.as_slice(), 132, want())?; |
| 39 | + |
| 40 | + Ok(()) |
| 41 | +} |
0 commit comments