Fix InMemoryLocalOverride root handling #59

Closed
opened 2024-04-02 07:58:28 +00:00 by dkirillov · 0 comments
Member

I suppose the following test should pass:

func TestName(t *testing.T) {
	s := NewInMemoryLocalOverrides()

	target := engine.NamespaceTarget("")

	id, err := s.LocalStorage().AddOverride(chain.S3, target, &chain.Chain{
		Rules: []chain.Rule{{
			Status:    chain.Allow,
			Actions:   chain.Actions{Names: []string{"s3:PutObject"}},
			Resources: chain.Resources{Names: []string{"*"}},
		}},
	})
	require.NoError(t, err)

	res, err := s.LocalStorage().ListOverrides(chain.S3, target)
	require.NoError(t, err)
	require.Len(t, res, 1)
	require.Equal(t, string(id), string(res[0].ID))
}

relates #55

@alexvanin @aarifullin

I suppose the following test should pass: ```golang func TestName(t *testing.T) { s := NewInMemoryLocalOverrides() target := engine.NamespaceTarget("") id, err := s.LocalStorage().AddOverride(chain.S3, target, &chain.Chain{ Rules: []chain.Rule{{ Status: chain.Allow, Actions: chain.Actions{Names: []string{"s3:PutObject"}}, Resources: chain.Resources{Names: []string{"*"}}, }}, }) require.NoError(t, err) res, err := s.LocalStorage().ListOverrides(chain.S3, target) require.NoError(t, err) require.Len(t, res, 1) require.Equal(t, string(id), string(res[0].ID)) } ``` relates #55 @alexvanin @aarifullin
dkirillov self-assigned this 2024-04-02 08:02:47 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/policy-engine#59
No description provided.