Skip to content

Commit

Permalink
fixed the types
Browse files Browse the repository at this point in the history
  • Loading branch information
oliveromahony committed Aug 15, 2023
1 parent 3426e5e commit a94337e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions client/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

const (
// APIVersion is the default version of NGINX Plus API supported by the client.
APIVersion = 8
APIVersion = 9

pathNotFoundCode = "PathNotFound"
streamContext = true
Expand All @@ -24,7 +24,7 @@ const (
)

var (
supportedAPIVersions = versions{4, 5, 6, 7, 8}
supportedAPIVersions = versions{4, 5, 6, 7, 8, 9}

// Default values for servers in Upstreams.
defaultMaxConns = 0
Expand Down Expand Up @@ -132,7 +132,7 @@ type Stats struct {
HTTPLimitRequests HTTPLimitRequests
HTTPLimitConnections HTTPLimitConnections
StreamLimitConnections StreamLimitConnections
Workers *Workers
Workers []*Workers
}

// NginxInfo contains general information about NGINX Plus.
Expand Down Expand Up @@ -1661,8 +1661,8 @@ func (client *NginxClient) GetStreamConnectionsLimit() (*StreamLimitConnections,
}

// GetWorkers returns workers stats.
func (client *NginxClient) GetWorkers() (*Workers, error) {
var workers *Workers
func (client *NginxClient) GetWorkers() ([]*Workers, error) {
var workers []*Workers
if client.version < 8 {
return workers, nil
}
Expand Down
2 changes: 1 addition & 1 deletion tests/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ func TestStats(t *testing.T) {
t.Errorf("Bad connections: %v", stats.Connections)
}

if stats.Workers == (&client.Workers{}) {
if len(stats.Workers) < 1 {
t.Errorf("Bad workers: %v", stats.Workers)
}

Expand Down

0 comments on commit a94337e

Please sign in to comment.