Compare commits
1 Commits
8d054f5f26
...
c6d34f87d7
| Author | SHA1 | Date | |
|---|---|---|---|
| c6d34f87d7 |
45
.github/workflows/test.yml
vendored
45
.github/workflows/test.yml
vendored
@@ -93,6 +93,7 @@ jobs:
|
|||||||
sudo apt-get install -y jq curl
|
sudo apt-get install -y jq curl
|
||||||
|
|
||||||
- name: Install with full configuration
|
- name: Install with full configuration
|
||||||
|
id: install
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
domains: |
|
domains: |
|
||||||
@@ -161,6 +162,43 @@ jobs:
|
|||||||
done
|
done
|
||||||
echo "::error::API not accessible after 60 seconds"
|
echo "::error::API not accessible after 60 seconds"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
|
- name: Debug - List created domains and users
|
||||||
|
run: |
|
||||||
|
echo "=== Reading Admin Password ==="
|
||||||
|
if [ -f /tmp/stalwart_admin_password ]; then
|
||||||
|
ADMIN_PASSWORD=$(cat /tmp/stalwart_admin_password)
|
||||||
|
echo "✓ Admin password retrieved"
|
||||||
|
else
|
||||||
|
echo "::error::Admin password file not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Listing Domains via API ==="
|
||||||
|
DOMAINS_RESPONSE=$(curl -s -u "admin:$ADMIN_PASSWORD" \
|
||||||
|
"http://localhost:8080/api/principal?types=domain&limit=100")
|
||||||
|
echo "$DOMAINS_RESPONSE" | jq '.data.items[] | {name, description, id}'
|
||||||
|
|
||||||
|
DOMAIN_COUNT=$(echo "$DOMAINS_RESPONSE" | jq '.data.total // 0')
|
||||||
|
echo "Total domains: $DOMAIN_COUNT"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Listing Users via API ==="
|
||||||
|
USERS_RESPONSE=$(curl -s -u "admin:$ADMIN_PASSWORD" \
|
||||||
|
"http://localhost:8080/api/principal?types=individual&limit=100")
|
||||||
|
echo "$USERS_RESPONSE" | jq '.data.items[] | {name, emails, roles, id}'
|
||||||
|
|
||||||
|
USER_COUNT=$(echo "$USERS_RESPONSE" | jq '.data.total // 0')
|
||||||
|
echo "Total users: $USER_COUNT"
|
||||||
|
|
||||||
|
# Verify expected users exist
|
||||||
|
if [ "$USER_COUNT" -ge 3 ]; then
|
||||||
|
echo "✓ Expected number of users created"
|
||||||
|
else
|
||||||
|
echo "::error::Expected at least 3 users, found $USER_COUNT"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Verify unauthenticated JMAP access
|
- name: Verify unauthenticated JMAP access
|
||||||
run: |
|
run: |
|
||||||
@@ -190,7 +228,12 @@ jobs:
|
|||||||
echo "HTTP Status Code: $HTTP_CODE"
|
echo "HTTP Status Code: $HTTP_CODE"
|
||||||
echo "JMAP Response:"
|
echo "JMAP Response:"
|
||||||
cat /tmp/jmap_response.json | jq '.' || cat /tmp/jmap_response.json
|
cat /tmp/jmap_response.json | jq '.' || cat /tmp/jmap_response.json
|
||||||
echo "::error::JMAP endpoint returned HTTP $HTTP_CODE"
|
|
||||||
|
# Check if request succeeded
|
||||||
|
if [ "$HTTP_CODE" != "200" ]; then
|
||||||
|
echo "::error::JMAP endpoint returned HTTP $HTTP_CODE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Verify username field contains our test user
|
# Verify username field contains our test user
|
||||||
USERNAME=$(cat /tmp/jmap_response.json | jq -r '.username // empty')
|
USERNAME=$(cat /tmp/jmap_response.json | jq -r '.username // empty')
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ main() {
|
|||||||
log_info "📝 Generated admin password: ${current_password}"
|
log_info "📝 Generated admin password: ${current_password}"
|
||||||
log_warning "⚠️ Save this password securely - it won't be shown again!"
|
log_warning "⚠️ Save this password securely - it won't be shown again!"
|
||||||
|
|
||||||
|
# Save admin password to temp file for testing/debugging (remove in production)
|
||||||
|
echo "$current_password" > /tmp/stalwart_admin_password
|
||||||
|
chmod 600 /tmp/stalwart_admin_password
|
||||||
|
|
||||||
# Create domains if provided
|
# Create domains if provided
|
||||||
if [ -n "$DOMAINS_JSON" ]; then
|
if [ -n "$DOMAINS_JSON" ]; then
|
||||||
log_info "Creating domains..."
|
log_info "Creating domains..."
|
||||||
@@ -280,7 +284,7 @@ create_users() {
|
|||||||
emails: [$email],
|
emails: [$email],
|
||||||
urls: [],
|
urls: [],
|
||||||
memberOf: [],
|
memberOf: [],
|
||||||
roles: [],
|
roles: ["user"],
|
||||||
lists: [],
|
lists: [],
|
||||||
members: [],
|
members: [],
|
||||||
enabledPermissions: [],
|
enabledPermissions: [],
|
||||||
@@ -297,7 +301,7 @@ create_users() {
|
|||||||
emails: [$email],
|
emails: [$email],
|
||||||
urls: [],
|
urls: [],
|
||||||
memberOf: [],
|
memberOf: [],
|
||||||
roles: [],
|
roles: ["user"],
|
||||||
lists: [],
|
lists: [],
|
||||||
members: [],
|
members: [],
|
||||||
enabledPermissions: [],
|
enabledPermissions: [],
|
||||||
|
|||||||
Reference in New Issue
Block a user