trpc.group/trpc-go/trpc-cmdline@v1.0.9/plugin/plugin_test.go (about)

     1  // Tencent is pleased to support the open source community by making tRPC available.
     2  //
     3  // Copyright (C) 2023 THL A29 Limited, a Tencent company.
     4  // All rights reserved.
     5  //
     6  // If you have downloaded a copy of the tRPC source code from Tencent,
     7  // please note that tRPC source code is licensed under the  Apache 2.0 License,
     8  // A copy of the Apache 2.0 License is included in this file.
     9  
    10  package plugin
    11  
    12  import (
    13  	"os"
    14  	"testing"
    15  
    16  	"trpc.group/trpc-go/trpc-cmdline/config"
    17  )
    18  
    19  func TestMain(m *testing.M) {
    20  	if err := setup(); err != nil {
    21  		panic(err)
    22  	}
    23  	os.Exit(m.Run())
    24  }
    25  
    26  func setup() error {
    27  	if _, err := config.Init(); err != nil {
    28  		return err
    29  	}
    30  	deps, err := config.LoadDependencies()
    31  	if err != nil {
    32  		return err
    33  	}
    34  	return config.SetupDependencies(deps)
    35  }