This repository has been archived by the owner on Mar 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
connection_test.go
62 lines (45 loc) · 1.49 KB
/
connection_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*** Copyright (c) 2016, The BioTeam, Inc. ***
*** For more information please refer to the LICENSE.md file ***/
package gorods
import (
"flag"
"fmt"
"testing"
)
var testCreds = ConnectionOptions{
Type: UserDefined,
}
var shouldTestPAM = false
func init() {
flag.StringVar(&testCreds.Host, "irods.host", "localhost", "Hostname of iRODS server, e.g. localhost")
flag.IntVar(&testCreds.Port, "irods.port", 1247, "Port of iRODS server, e.g. 1247")
flag.StringVar(&testCreds.Zone, "irods.zone", "tempZone", "Zone to use in connection to iRODS server, e.g. tempZone")
flag.StringVar(&testCreds.Username, "irods.username", "rods", "Username to use in connection to iRODS server, e.g. rods")
flag.StringVar(&testCreds.Password, "irods.password", "testpassword", "Password to use in connection to iRODS server, e.g. testpassword")
flag.BoolVar(&shouldTestPAM, "irods.testpam", false, "Should try to connect with PAM")
flag.Parse()
if shouldTestPAM {
testCreds.AuthType = PAMAuth
}
fmt.Printf("Setup testing with params: %v\n", testCreds.String())
}
func TestUserDefinedConnection(t *testing.T) {
if irods, err := NewConnection(&testCreds); err != nil {
t.Fatal(err)
} else {
if er := irods.Disconnect(); er != nil {
t.Fatal(er)
}
}
}
func TestIQuestSQL(t *testing.T) {
irods, conErr := NewConnection(&testCreds)
if conErr != nil {
t.Fatal(conErr)
}
results, _ := irods.IQuestSQL("ls")
if er := irods.Disconnect(); er != nil {
t.Fatal(er)
}
t.Log(results)
}