github.com/openimsdk/tools@v0.0.49/db/mongoutil/mongo_test.go (about)

     1  // Copyright © 2024 OpenIM open source community. All rights reserved.
     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 mongoutil
    16  
    17  //func Test_connectWithRetry(t *testing.T) {
    18  //	type args struct {
    19  //		ctx         context.Context
    20  //		clientOpts  *options.ClientOptions
    21  //		maxRetry    int
    22  //		connTimeout time.Duration
    23  //	}
    24  //	tests := []struct {
    25  //		name    string
    26  //		args    args
    27  //		want    *mongo.Client
    28  //		wantErr bool
    29  //	}{
    30  //		// TODO: Add test cases.
    31  //	}
    32  //	for _, tt := range tests {
    33  //		t.Run(tt.name, func(t *testing.T) {
    34  //			got, err := connectWithRetry(tt.args.ctx, tt.args.clientOpts, tt.args.maxRetry, tt.args.connTimeout)
    35  //			if (err != nil) != tt.wantErr {
    36  //				t.Errorf("connectWithRetry() error = %v, wantErr %v", err, tt.wantErr)
    37  //				return
    38  //			}
    39  //			if !reflect.DeepEqual(got, tt.want) {
    40  //				t.Errorf("connectWithRetry() = %v, want %v", got, tt.want)
    41  //			}
    42  //		})
    43  //	}
    44  //}
    45  //
    46  //func TestCheckMongo(t *testing.T) {
    47  //	type args struct {
    48  //		ctx    context.Context
    49  //		config *Config
    50  //	}
    51  //	tests := []struct {
    52  //		name    string
    53  //		args    args
    54  //		wantErr bool
    55  //	}{
    56  //		// TODO: Add test cases.
    57  //	}
    58  //	for _, tt := range tests {
    59  //		t.Run(tt.name, func(t *testing.T) {
    60  //			if err := CheckMongo(tt.args.ctx, tt.args.config); (err != nil) != tt.wantErr {
    61  //				t.Errorf("CheckMongo() error = %v, wantErr %v", err, tt.wantErr)
    62  //			}
    63  //		})
    64  //	}
    65  //}