|
40 | 40 | # Check if the required scripts exist and are executable |
41 | 41 | docker run --rm trakt-export:test ls -la /app/Export_Trakt_4_Letterboxd.sh /app/setup_trakt.sh /app/docker-entrypoint.sh |
42 | 42 |
|
| 43 | + # Check if lib directory exists and scripts are executable |
| 44 | + docker run --rm trakt-export:test bash -c "find /app/lib -name '*.sh' -type f -executable || echo 'No executable scripts found in lib directory'" |
| 45 | +
|
43 | 46 | # Check if the required directories exist |
44 | | - docker run --rm trakt-export:test ls -la /app/config /app/logs /app/copy /app/brain_ops /app/backup /app/TEMP |
| 47 | + docker run --rm trakt-export:test ls -la /app/config /app/logs /app/copy /app/backup /app/TEMP |
45 | 48 |
|
46 | 49 | # Check if the entrypoint script works correctly |
47 | 50 | docker run --rm trakt-export:test bash -c "test -x /app/docker-entrypoint.sh && echo '✅ Entrypoint script is executable'" |
|
94 | 97 |
|
95 | 98 | echo "✅ Docker Compose test completed successfully" |
96 | 99 |
|
97 | | - - name: Test Docker image with mock data |
98 | | - run: | |
99 | | - echo "🔍 Testing Docker image with mock data..." |
100 | | -
|
101 | | - # Create a test container with mounted volumes |
102 | | - mkdir -p ./test-data/config ./test-data/logs ./test-data/copy ./test-data/brain_ops ./test-data/backup |
103 | | -
|
104 | | - # Create a mock configuration file |
105 | | - cat > ./test-data/config/.config.cfg << 'EOF' |
106 | | - API_KEY="test_key" |
107 | | - API_SECRET="test_secret" |
108 | | - API_URL="https://api.trakt.tv" |
109 | | - ACCESS_TOKEN="test_token" |
110 | | - REFRESH_TOKEN="test_refresh" |
111 | | - REDIRECT_URI="urn:ietf:wg:oauth:2.0:oob" |
112 | | - USERNAME="test_user" |
113 | | - BACKUP_DIR="./backup/test_backup" |
114 | | - DOSLOG="./logs" |
115 | | - DOSCOPY="./copy" |
116 | | - BRAIN_OPS="./brain_ops" |
117 | | - DATE="20250101_0000" |
118 | | - LOG="${DOSLOG}/test-Export_Trakt.txt" |
119 | | - RED='\033[0;31m' |
120 | | - GREEN='\033[0;32m' |
121 | | - NC='\033[0m' |
122 | | - BOLD='\033[1m' |
123 | | - SAISPAS='\e[1;33;41m' |
124 | | - EOF |
125 | | -
|
126 | | - # Create example config file in the test directory |
127 | | - cp ./test-data/config/.config.cfg ./test-data/config/.config.cfg.example |
128 | | -
|
129 | | - # Start the container with the mock data and keep it running with sleep |
130 | | - docker run -d --name test-container-mock \ |
131 | | - -v $(pwd)/test-data/config:/app/config \ |
132 | | - -v $(pwd)/test-data/logs:/app/logs \ |
133 | | - -v $(pwd)/test-data/copy:/app/copy \ |
134 | | - -v $(pwd)/test-data/brain_ops:/app/brain_ops \ |
135 | | - -v $(pwd)/test-data/backup:/app/backup \ |
136 | | - trakt-export:test sleep 60 |
137 | | -
|
138 | | - # Wait a moment to ensure the container is running |
139 | | - sleep 5 |
140 | | -
|
141 | | - # Check if the container is running |
142 | | - docker ps | grep test-container-mock |
143 | | -
|
144 | | - # Check if the container can access the mounted volumes |
145 | | - docker exec test-container-mock bash -c "ls -la /app/config /app/logs /app/copy /app/brain_ops /app/backup" |
146 | | -
|
147 | | - # Check if the configuration file is accessible |
148 | | - docker exec test-container-mock bash -c "cat /app/config/.config.cfg | grep API_KEY" |
149 | | -
|
150 | | - # Clean up |
151 | | - docker stop test-container-mock |
152 | | - docker rm test-container-mock |
153 | | - rm -rf ./test-data |
154 | | -
|
155 | | - echo "✅ Docker image test with mock data completed successfully" |
156 | | -
|
157 | 100 | - name: Summary |
158 | 101 | run: | |
159 | 102 | echo "🎉 All Docker image tests passed successfully!" |
|
0 commit comments