From 64de575b9c8f62479aea4c8f8530647816552b2b Mon Sep 17 00:00:00 2001 From: ChaitanyaD48 Date: Mon, 15 Jan 2024 23:07:33 +0530 Subject: [PATCH 1/2] Add CheckAccessActor and CheckAccessHTTP tests for MONITORING role Signed-off-by: ChaitanyaD48 --- go/acl/acl_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/go/acl/acl_test.go b/go/acl/acl_test.go index 680044c1461..dfc4f7cba8a 100644 --- a/go/acl/acl_test.go +++ b/go/acl/acl_test.go @@ -57,6 +57,10 @@ func TestSimplePolicy(t *testing.T) { if err != nil { t.Errorf("got %v, want no error", err) } + err = CheckAccessActor("", MONITORING) + if err != nil { + t.Errorf("got %v, want no error", err) + } err = CheckAccessHTTP(nil, ADMIN) if err == nil || err.Error() != want { @@ -66,6 +70,10 @@ func TestSimplePolicy(t *testing.T) { if err != nil { t.Errorf("got %v, want no error", err) } + err = CheckAccessHTTP(nil, MONITORING) + if err != nil { + t.Errorf("got %v, want no error", err) + } } func TestEmptyPolicy(t *testing.T) { @@ -78,6 +86,10 @@ func TestEmptyPolicy(t *testing.T) { if err != nil { t.Errorf("got %v, want no error", err) } + err = CheckAccessActor("", MONITORING) + if err != nil { + t.Errorf("got %v, want no error", err) + } err = CheckAccessHTTP(nil, ADMIN) if err != nil { @@ -87,4 +99,8 @@ func TestEmptyPolicy(t *testing.T) { if err != nil { t.Errorf("got %v, want no error", err) } + err = CheckAccessHTTP(nil, MONITORING) + if err != nil { + t.Errorf("got %v, want no error", err) + } } From 74d01ab8a7c23611f2e6483eef2912f5e7ba746e Mon Sep 17 00:00:00 2001 From: ChaitanyaD48 Date: Fri, 19 Jan 2024 22:56:48 +0530 Subject: [PATCH 2/2] Add MONITORING access check Signed-off-by: ChaitanyaD48 --- go/acl/acl_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/go/acl/acl_test.go b/go/acl/acl_test.go index 1c3ad703167..65f6ed2b96d 100644 --- a/go/acl/acl_test.go +++ b/go/acl/acl_test.go @@ -62,12 +62,17 @@ func TestSimplePolicy(t *testing.T) { err = CheckAccessActor("", DEBUGGING) assert.Equalf(t, err, nil, "got %v, want no error", err) + err = CheckAccessActor("", MONITORING) + assert.Equalf(t, err, nil, "got %v, want no error", err) + err = CheckAccessHTTP(nil, ADMIN) assert.Equalf(t, err.Error(), want, "got %v, want %s", err, want) err = CheckAccessHTTP(nil, DEBUGGING) assert.Equalf(t, err, nil, "got %v, want no error", err) + err = CheckAccessHTTP(nil, MONITORING) + assert.Equalf(t, err, nil, "got %v, want no error", err) } func TestEmptyPolicy(t *testing.T) { @@ -78,11 +83,17 @@ func TestEmptyPolicy(t *testing.T) { err = CheckAccessActor("", DEBUGGING) assert.Equalf(t, err, nil, "got %v, want no error", err) + err = CheckAccessActor("", MONITORING) + assert.Equalf(t, err, nil, "got %v, want no error", err) + err = CheckAccessHTTP(nil, ADMIN) assert.Equalf(t, err, nil, "got %v, want no error", err) err = CheckAccessHTTP(nil, DEBUGGING) assert.Equalf(t, err, nil, "got %v, want no error", err) + + err = CheckAccessHTTP(nil, MONITORING) + assert.Equalf(t, err, nil, "got %v, want no error", err) } func TestValidSecurityPolicy(t *testing.T) { @@ -145,4 +156,4 @@ func TestAlreadyRegisteredPolicy(t *testing.T) { } t.Errorf("process ran with err %v, want exit status 1", err) -} \ No newline at end of file +}