Skip to content

Commit

Permalink
FIX : server version does not require conneciton
Browse files Browse the repository at this point in the history
  • Loading branch information
sgonzalezoyuela committed Dec 20, 2022
1 parent 0c389b6 commit 833b765
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
9 changes: 2 additions & 7 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,7 @@ func (c *IdbusApiClient) Authn() error {

}

func ServerVersion() (string, error) {

cfg, err := GetServerConfigFromEnv()
if err != nil {
return "", fmt.Errorf("cannot get version from IAMTF/JOSSO server [%s]: %v", cfg.Config.URL, err)
}
func ServerVersion(cfg *IdbusServer) (string, error) {

c1, err := CreateClient(cfg, false)
if err != nil {
Expand Down Expand Up @@ -204,7 +199,7 @@ func CreateClient(s *IdbusServer, authn bool) (*IdbusApiClient, error) {
trace = false
}

l := DefaultLogger{debug: true}
l := DefaultLogger{debug: trace}

c := NewIdbusApiClient(&l, trace)
err = c.RegisterServer(s, "")
Expand Down
11 changes: 9 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,16 @@ func TestMarshalJSON(t *testing.T) {

func (s *AccTestSuite) TestVersion() {
var t = s.T()
v, err := ServerVersion()

cfg, err := GetServerConfigFromEnv()
if err != nil {
s.client.Logger().Errorf("cannot get server config %v", err)
t.Error(err)
return
}
v, err := ServerVersion(cfg)
if err != nil {
s.client.Logger().Errorf("cannot get test appliance %v", err)
s.client.Logger().Errorf("cannot get server version %v", err)
t.Error(err)
return
}
Expand Down

0 comments on commit 833b765

Please sign in to comment.