...

Source file src/go.etcd.io/etcd/server/v3/config/v2_deprecation_test.go

Documentation: go.etcd.io/etcd/server/v3/config

     1  // Copyright 2021 The etcd Authors
     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  package config
    16  
    17  import "testing"
    18  
    19  func TestV2DeprecationEnum_IsAtLeast(t *testing.T) {
    20  	tests := []struct {
    21  		e    V2DeprecationEnum
    22  		v2d  V2DeprecationEnum
    23  		want bool
    24  	}{
    25  		{V2_DEPR_0_NOT_YET, V2_DEPR_0_NOT_YET, true},
    26  		{V2_DEPR_0_NOT_YET, V2_DEPR_1_WRITE_ONLY_DROP, false},
    27  		{V2_DEPR_0_NOT_YET, V2_DEPR_2_GONE, false},
    28  		{V2_DEPR_2_GONE, V2_DEPR_1_WRITE_ONLY_DROP, true},
    29  		{V2_DEPR_2_GONE, V2_DEPR_0_NOT_YET, true},
    30  		{V2_DEPR_2_GONE, V2_DEPR_2_GONE, true},
    31  		{V2_DEPR_1_WRITE_ONLY, V2_DEPR_1_WRITE_ONLY_DROP, false},
    32  		{V2_DEPR_1_WRITE_ONLY_DROP, V2_DEPR_1_WRITE_ONLY, true},
    33  	}
    34  	for _, tt := range tests {
    35  		t.Run(string(tt.e)+" >= "+string(tt.v2d), func(t *testing.T) {
    36  			if got := tt.e.IsAtLeast(tt.v2d); got != tt.want {
    37  				t.Errorf("IsAtLeast() = %v, want %v", got, tt.want)
    38  			}
    39  		})
    40  	}
    41  }
    42  

View as plain text