@@ -73,6 +73,7 @@ func TestServerListResource(t *testing.T) {
7373 server * fwserver.Server
7474 request * fwserver.ListRequest
7575 expectedStreamEvents []fwserver.ListResult
76+ expectedError string
7677 }{
7778 "success-with-zero-results" : {
7879 server : & fwserver.Server {
@@ -166,6 +167,21 @@ func TestServerListResource(t *testing.T) {
166167 },
167168 },
168169 },
170+ "error-on-nil-config" : {
171+ server : & fwserver.Server {
172+ Provider : & testprovider.Provider {},
173+ },
174+ request : & fwserver.ListRequest {
175+ Config : nil ,
176+ ListResource : & testprovider.ListResource {
177+ ListMethod : func (ctx context.Context , req list.ListRequest , resp * list.ListResultsStream ) {
178+ resp .Results = list .NoListResults
179+ },
180+ },
181+ },
182+ expectedError : "Invalid ListResource request: Config cannot be nil" ,
183+ expectedStreamEvents : []fwserver.ListResult {},
184+ },
169185 "error-on-nil-resource-identity" : {
170186 server : & fwserver.Server {
171187 Provider : & testprovider.Provider {},
@@ -244,7 +260,7 @@ func TestServerListResource(t *testing.T) {
244260
245261 response := & fwserver.ListResultsStream {}
246262 err := testCase .server .ListResource (context .Background (), testCase .request , response )
247- if err != nil {
263+ if err != nil && err . Error () != testCase . expectedError {
248264 t .Fatalf ("unexpected error: %s" , err )
249265 }
250266
0 commit comments