mirror of
https://github.com/wekan/wekan.git
synced 2026-01-02 23:58:49 +01:00
Refactor e2e workflow by removing bcrypt hash generation and test user creation steps for improved clarity and efficiency
This commit is contained in:
parent
0ae8411084
commit
730cfd3f69
1 changed files with 1 additions and 82 deletions
83
.github/workflows/e2e-testing.yml
vendored
83
.github/workflows/e2e-testing.yml
vendored
|
|
@ -78,7 +78,7 @@ jobs:
|
|||
# Clean up networks (volumes already removed above)
|
||||
sudo docker network prune -f || true
|
||||
|
||||
echo "${{ secrets.DOCKERHUB_PASSWORD }}" | sudo docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
|
||||
echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
|
||||
|
||||
sudo docker compose pull
|
||||
sudo docker compose up -d
|
||||
|
|
@ -101,87 +101,6 @@ jobs:
|
|||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Generate bcrypt hash and create user
|
||||
run: |
|
||||
# Generate bcrypt hash for "123456" using Python
|
||||
BCRYPT_HASH=$(python3 -c "
|
||||
import bcrypt
|
||||
password = '123456'.encode('utf-8')
|
||||
hash = bcrypt.hashpw(password, bcrypt.gensalt(rounds=10))
|
||||
print(hash.decode('utf-8'))
|
||||
")
|
||||
echo "Generated hash: ${BCRYPT_HASH:0:20}..."
|
||||
echo "BCRYPT_HASH=$BCRYPT_HASH" >> $GITHUB_ENV
|
||||
|
||||
- name: Create test user via Database
|
||||
uses: appleboy/ssh-action@v1.0.3
|
||||
with:
|
||||
host: ${{ secrets.WEKAN_EC2_HOST_IP }}
|
||||
username: ubuntu
|
||||
key: ${{ secrets.EC2_SSH_KEY }}
|
||||
script: |
|
||||
# Wait for containers to be ready
|
||||
echo "⏳ Waiting for Wekan containers to start..."
|
||||
sleep 30
|
||||
|
||||
# Check if containers are running
|
||||
echo "🔍 Checking container status..."
|
||||
sudo docker ps
|
||||
|
||||
# Create test user with generated hash
|
||||
echo "👤 Creating test user: omriza5"
|
||||
sudo docker exec wekan-db mongosh wekan --eval '
|
||||
// Remove user if exists (for clean testing)
|
||||
db.users.deleteMany({username: "omriza5"});
|
||||
|
||||
const userId = "omriza5_" + new Date().getTime();
|
||||
const now = new Date();
|
||||
|
||||
// Use the generated bcrypt hash
|
||||
const result = db.users.insertOne({
|
||||
_id: userId,
|
||||
username: "omriza5",
|
||||
emails: [{ address: "omriza5@gmail.com", verified: false }],
|
||||
services: {
|
||||
password: {
|
||||
bcrypt: "${{ env.BCRYPT_HASH }}"
|
||||
}
|
||||
},
|
||||
profile: {
|
||||
boardView: "board-view-swimlanes",
|
||||
listSortBy: "-modifiedAt",
|
||||
templatesBoardId: "",
|
||||
cardTemplatesSwimlaneId: "",
|
||||
listTemplatesSwimlaneId: "",
|
||||
boardTemplatesSwimlaneId: "",
|
||||
listWidths: {},
|
||||
listConstraints: {},
|
||||
autoWidthBoards: {},
|
||||
swimlaneHeights: {},
|
||||
keyboardShortcuts: false,
|
||||
verticalScrollbars: true,
|
||||
showWeekOfYear: true
|
||||
},
|
||||
isAdmin: false,
|
||||
authenticationMethod: "password",
|
||||
sessionData: {},
|
||||
createdAt: now,
|
||||
modifiedAt: now
|
||||
});
|
||||
|
||||
if (result.acknowledged) {
|
||||
print("✅ User omriza5 created successfully with ID: " + userId);
|
||||
} else {
|
||||
print("❌ Failed to create user");
|
||||
}
|
||||
' || echo "❌ Failed to execute MongoDB command"
|
||||
|
||||
# Verify user was created
|
||||
echo "🔍 Verifying user creation..."
|
||||
sudo docker exec wekan-db mongosh wekan --eval 'db.users.findOne({username: "omriza5"}, {username: 1, emails: 1, isAdmin: 1, _id: 1})' || echo "❌ Failed to verify user"
|
||||
|
||||
echo "✅ Test user setup complete!"
|
||||
|
||||
- name: Run API tests
|
||||
env:
|
||||
BASE_URL: ${{ secrets.WEKAN_URL }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue