libgit2: Enable tests

TestMain() without m.Run() resulted in none of the tests being run.

This libgit2 package contains tests for both managed and unmanaged
transports, enabling it in TestMain() for everything results in the
unmanaged transport tests to not run. Add managed transport
initialization call to all the managed transport tests to allow
unmanaged transport tests to run.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit is contained in:
Sunny 2022-05-28 22:48:27 +05:30
parent 36bbaf0a49
commit 86610667b1
No known key found for this signature in database
GPG Key ID: 9F3D25DDFF7FA3CF
1 changed files with 9 additions and 4 deletions

View File

@ -42,13 +42,11 @@ import (
const testRepositoryPath = "../testdata/git/repo"
func TestMain(m *testing.M) {
managed.InitManagedTransport(logr.Discard())
}
// Test_ManagedSSH_KeyTypes assures support for the different
// types of keys for SSH Authentication supported by Flux.
func Test_ManagedSSH_KeyTypes(t *testing.T) {
managed.InitManagedTransport(logr.Discard())
tests := []struct {
name string
keyType ssh.KeyPairType
@ -176,6 +174,8 @@ func Test_ManagedSSH_KeyTypes(t *testing.T) {
// Test_ManagedSSH_KeyExchangeAlgos assures support for the different
// types of SSH key exchange algorithms supported by Flux.
func Test_ManagedSSH_KeyExchangeAlgos(t *testing.T) {
managed.InitManagedTransport(logr.Discard())
tests := []struct {
name string
ClientKex []string
@ -297,6 +297,8 @@ func Test_ManagedSSH_KeyExchangeAlgos(t *testing.T) {
// Test_ManagedSSH_HostKeyAlgos assures support for the different
// types of SSH Host Key algorithms supported by Flux.
func Test_ManagedSSH_HostKeyAlgos(t *testing.T) {
managed.InitManagedTransport(logr.Discard())
tests := []struct {
name string
keyType ssh.KeyPairType
@ -457,6 +459,7 @@ func Test_ManagedSSH_HostKeyAlgos(t *testing.T) {
}
func Test_ManagedHTTPCheckout(t *testing.T) {
managed.InitManagedTransport(logr.Discard())
g := NewWithT(t)
timeout := 5 * time.Second
@ -496,6 +499,7 @@ func Test_ManagedHTTPCheckout(t *testing.T) {
}
func TestManagedCheckoutBranch_Checkout(t *testing.T) {
managed.InitManagedTransport(logr.Discard())
g := NewWithT(t)
timeout := 5 * time.Second
@ -551,6 +555,7 @@ func TestManagedCheckoutBranch_Checkout(t *testing.T) {
}
func TestManagedCheckoutTag_Checkout(t *testing.T) {
managed.InitManagedTransport(logr.Discard())
g := NewWithT(t)
timeout := 5 * time.Second