github.com/dannyzhou2015/migrate/v4@v4.15.2/source/gitlab/gitlab_test.go (about)

     1  package gitlab
     2  
     3  import (
     4  	"bytes"
     5  	"io/ioutil"
     6  	"testing"
     7  
     8  	st "github.com/dannyzhou2015/migrate/v4/source/testing"
     9  )
    10  
    11  var GitlabTestSecret = "" // username:token
    12  
    13  func init() {
    14  	secrets, err := ioutil.ReadFile(".gitlab_test_secrets")
    15  	if err == nil {
    16  		GitlabTestSecret = string(bytes.TrimSpace(secrets)[:])
    17  	}
    18  }
    19  
    20  func Test(t *testing.T) {
    21  	if len(GitlabTestSecret) == 0 {
    22  		t.Skip("test requires .gitlab_test_secrets")
    23  	}
    24  
    25  	g := &Gitlab{}
    26  	d, err := g.Open("gitlab://" + GitlabTestSecret + "@gitlab.com/11197284/migrations")
    27  	if err != nil {
    28  		t.Fatal(err)
    29  	}
    30  
    31  	st.Test(t, d)
    32  }