github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/pkg/plugin/cluster_check_plugin_test.go (about)

     1  // Copyright © 2021 Alibaba Group Holding Ltd.
     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 plugin
    16  
    17  import (
    18  	"testing"
    19  
    20  	v1 "github.com/alibaba/sealer/types/api/v1"
    21  )
    22  
    23  func TestClusterCheck_Run(t *testing.T) {
    24  	type fields struct{}
    25  
    26  	plugin := &v1.Plugin{}
    27  
    28  	type args struct {
    29  		context Context
    30  		phase   Phase
    31  	}
    32  	tests := []struct {
    33  		name    string
    34  		fields  fields
    35  		args    args
    36  		wantErr bool
    37  	}{
    38  		// TODO: Add test cases.
    39  		{
    40  			"test check cluster status",
    41  			fields{},
    42  			args{
    43  				context: Context{
    44  					Plugin: plugin,
    45  				},
    46  				phase: PhasePreGuest,
    47  			},
    48  			false,
    49  		},
    50  	}
    51  	for _, tt := range tests {
    52  		t.Run(tt.name, func(t *testing.T) {
    53  			c := ClusterChecker{}
    54  			if err := c.Run(tt.args.context, tt.args.phase); (err != nil) != tt.wantErr {
    55  				t.Errorf("clusterCheck.Run() error = %v, wantErr %v", err, tt.wantErr)
    56  			}
    57  		})
    58  	}
    59  }