Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration test for GetAuthorizedEntries RPC #5356

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

valverdethiago
Copy link

@valverdethiago valverdethiago commented Aug 5, 2024

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included?
  • Documentation updated?

Affected functionality
N/A

Description of change
Add an integration test that ensures continued operation of the GetAuthorizedEntires RPC. This is scoped to:

  • Make a Node-Alias-based Registration.
  • Enabled Event-driven cache validation on spire-server

Which issue this PR fixes
Fixes #4811

@valverdethiago valverdethiago changed the title Add integration test for GetAuthorizedEntries RPC including join toke… Add integration test for GetAuthorizedEntries RPC Aug 5, 2024
…n and alias entry creation

Signed-off-by: Thiago Valverde de Souza <valverde.thiago@gmail.com>

d Please enter the commit message for your changes. Lines starting
@valverdethiago valverdethiago force-pushed the integration-test-for-GetAuthroizedEntries-RPC branch from e684e4b to 8a8168b Compare August 5, 2024 17:01
srv.EnableEventDrivenCacheValidation()

// Wait for the cache to update
time.Sleep(2 * time.Second)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time.Sleep(2 * time.Second)

I don't know maintainers' tolerance for potential flake in tests :)
do we have another mechanism/preference vs sleep in tests?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should opt for exponential retry here which should be more reliable.

@azdagron azdagron self-assigned this Aug 6, 2024
@valverdethiago valverdethiago force-pushed the integration-test-for-GetAuthroizedEntries-RPC branch from 8389b28 to ae62b45 Compare August 18, 2024 16:01
@valverdethiago valverdethiago force-pushed the integration-test-for-GetAuthroizedEntries-RPC branch from da2cc4d to bced4a6 Compare August 18, 2024 20:48
@amartinezfayo amartinezfayo assigned MarcosDY and unassigned azdagron Aug 22, 2024
exit 1
else
echo "Entry with SPIFFE ID ${SPIFFE_ID} exists."
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amoore877 amoore877 marked this pull request as draft September 4, 2024 20:54

log-debug "bootstrapping agent..."
docker compose exec -T spire-server \
/opt/spire/bin/spire-server bundle show > conf/agent/bootstrap.crt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see other CI needing these setups you have here since shared creds already are checked in


for ((m=1;m<=$SIZE;m++)); do
check-synced-entry "spire-agent" "spiffe://domain.test/workload-$m"
done
Copy link
Member

@amoore877 amoore877 Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's simplify CI and make each step distinct; checking in agent that entries are synced is separate from their creation

however, that probably also could just be a separate integration test (if doesn't already exist)? do we need the agent to come up at all for us to make the later GetAuthorizedEntries call?

verify_registration_entry() {
local response

response=$(list_entries)
Copy link
Member

@amoore877 amoore877 Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to verify the full list of entries to test GetAuthorizedEntries? that could be a separate integration test (if it doesn't already exist)

Comment on lines +66 to +68
# Prepare the test data
echo "Setting up test data..."
# (Include any commands to set up test data here)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Prepare the test data
echo "Setting up test data..."
# (Include any commands to set up test data here)

we're not setting up test data here

- Creates necessary registration entries for testing.

3. **Assert Entities Creation (`03-assert-entities-created.sh`)**
- Creates necessary registration entries for testing.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Creates necessary registration entries for testing.
- Checks necessary registration entries are retrieveable.

@amoore877
Copy link
Member

please stop using force push :) it clears all comments out on the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integration test for GetAuthorizedEntries behavior
5 participants