Skip to content

Commit d2c8c52

Browse files
Merge pull request #2007 from nextcloud/test-stable-oldest
Drone: test on oldest and latest stable server
2 parents 3e61a5e + 5d60464 commit d2c8c52

9 files changed

Lines changed: 177 additions & 17 deletions

File tree

.drone.yml

Lines changed: 127 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ services:
107107
- su www-data -c "git clone --depth 1 https://github.com/nextcloud/photos.git /var/www/html/apps/photos/"
108108
- su www-data -c "cd /var/www/html/apps/photos; composer install --no-dev"
109109
- su www-data -c "php /var/www/html/occ app:enable -f photos"
110-
- su www-data -c "git clone --depth 1 https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/"
110+
- su www-data -c "git clone --depth 1 -b main https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/"
111111
- su www-data -c "cd /var/www/html/apps/assistant; source ~/.bashrc; composer install --no-dev"
112112
- su www-data -c "php /var/www/html/occ app:enable -f assistant"
113113
- su www-data -c "php /var/www/html/occ app:enable -f testing"
@@ -128,7 +128,7 @@ trigger:
128128
---
129129
kind: pipeline
130130
type: docker
131-
name: test-stable
131+
name: test-stable-latest
132132

133133
steps:
134134
- name: test
@@ -145,16 +145,16 @@ steps:
145145
from_secret: GIT_TOKEN
146146
commands:
147147
- emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 &
148-
- sed -i s"#server#server-stable#" gradle.properties
148+
- sed -i s"#server#server-stable-latest#" gradle.properties
149149
- sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt
150150
- ./gradlew assembleDebug
151151
- ./scripts/wait_for_emulator.sh
152-
- ./scripts/wait_for_server.sh server-stable
153-
- scripts/deleteOutdatedComments.sh "stable" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
154-
- scripts/deleteOutdatedComments.sh "stable" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
155-
- ./gradlew jacocoTestDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
152+
- ./scripts/wait_for_server.sh server-stable-latest
153+
- scripts/deleteOutdatedComments.sh "stable-latest" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
154+
- scripts/deleteOutdatedComments.sh "stable-latest" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
155+
- ./gradlew jacocoTestDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable-latest" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
156156
- ./gradlew installDebugAndroidTest
157-
- ./gradlew createDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
157+
- ./gradlew createDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable-latest" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
158158
- ./gradlew combinedTestReport
159159
- curl -Os https://uploader.codecov.io/latest/linux/codecov
160160
- chmod +x codecov
@@ -184,10 +184,10 @@ steps:
184184
- stable-*
185185

186186
services:
187-
- name: server-stable
187+
- name: server-stable-latest
188188
image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest
189189
environment:
190-
SERVER_VERSION: stable32
190+
SERVER_VERSION: stable33
191191
commands:
192192
- rm /etc/apt/sources.list.d/php.list
193193
- apt-get update && apt-get install -y composer
@@ -229,7 +229,7 @@ services:
229229
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/photos.git /var/www/html/apps/photos/"
230230
- su www-data -c "cd /var/www/html/apps/photos; composer install --no-dev"
231231
- su www-data -c "php /var/www/html/occ app:enable -f photos"
232-
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/"
232+
- su www-data -c "git clone --depth 1 -b main https://github.com/nextcloud/assistant.git /var/www/html/apps/assistant/"
233233
- su www-data -c "cd /var/www/html/apps/assistant; source ~/.bashrc; composer install --no-dev"
234234
- su www-data -c "php /var/www/html/occ app:enable assistant"
235235
- su www-data -c "php /var/www/html/occ app:enable -f testing"
@@ -248,7 +248,122 @@ trigger:
248248
- push
249249
- pull_request
250250
---
251+
kind: pipeline
252+
type: docker
253+
name: test-stable-oldest
254+
255+
steps:
256+
- name: test
257+
image: ghcr.io/nextcloud/continuous-integration-android8:4
258+
privileged: true
259+
environment:
260+
LOG_USERNAME:
261+
from_secret: LOG_USERNAME
262+
LOG_PASSWORD:
263+
from_secret: LOG_PASSWORD
264+
GIT_USERNAME:
265+
from_secret: GIT_USERNAME
266+
GIT_TOKEN:
267+
from_secret: GIT_TOKEN
268+
commands:
269+
- emulator -avd android -no-snapshot -gpu swiftshader_indirect -no-window -no-audio -skin 500x833 &
270+
- sed -i s"#server#server-stable-oldest#" gradle.properties
271+
- sed -i s"#1#5#" ./library/src/androidTest/java/com/owncloud/android/RetryTestRule.kt
272+
- ./gradlew assembleDebug
273+
- ./scripts/wait_for_emulator.sh
274+
- ./scripts/wait_for_server.sh server-stable-oldest
275+
- scripts/deleteOutdatedComments.sh "stable-oldest" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
276+
- scripts/deleteOutdatedComments.sh "stable-oldest" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
277+
- ./gradlew jacocoTestDebugUnitTestReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable-oldest" "Unit" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
278+
- ./gradlew installDebugAndroidTest
279+
- ./gradlew createDebugCoverageReport || scripts/uploadReport.sh $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER "stable-oldest" "IT" $DRONE_PULL_REQUEST $GIT_USERNAME $GIT_TOKEN
280+
- ./gradlew combinedTestReport
281+
- curl -Os https://uploader.codecov.io/latest/linux/codecov
282+
- chmod +x codecov
283+
- ./codecov -t 2eec98c3-ff20-4cad-9e08-463471a33431
284+
285+
- name: notify
286+
image: drillster/drone-email
287+
settings:
288+
port: 587
289+
from: nextcloud-drone@kaminsky.me
290+
recipients_only: true
291+
username:
292+
from_secret: EMAIL_USERNAME
293+
password:
294+
from_secret: EMAIL_PASSWORD
295+
recipients:
296+
from_secret: EMAIL_RECIPIENTS
297+
host:
298+
from_secret: EMAIL_HOST
299+
when:
300+
event:
301+
- push
302+
status:
303+
- failure
304+
branch:
305+
- master
306+
- stable-*
307+
308+
services:
309+
- name: server-stable-oldest
310+
image: ghcr.io/nextcloud/continuous-integration-shallow-server-php7.4:1
311+
environment:
312+
SERVER_VERSION: stable20
313+
commands:
314+
- rm /etc/apt/sources.list.d/php.list
315+
- apt-get update && apt-get install -y composer
316+
- mkdir /var/www/.nvm /var/www/.npm; touch /var/www/.bashrc; chown -R 33:33 /var/www/.nvm /var/www/.npm /var/www/.bashrc
317+
- su www-data -c "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash"
318+
- su www-data -c "source ~/.bashrc; nvm install node"
319+
- BRANCH="$SERVER_VERSION" /usr/local/bin/initnc.sh
320+
- su www-data -c "php /var/www/html/occ log:manage --level warning"
321+
- su www-data -c "OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1"
322+
- su www-data -c "OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2"
323+
- su www-data -c "OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3"
324+
- su www-data -c "OC_PASS=test php /var/www/html/occ user:add --password-from-env --display-name='Test@Test' test@test"
325+
- su www-data -c "OC_PASS=test php /var/www/html/occ user:add --password-from-env --display-name='Test Spaces' 'test test'"
326+
- su www-data -c "php /var/www/html/occ user:setting user2 files quota 1G"
327+
- su www-data -c "php /var/www/html/occ group:add users"
328+
- su www-data -c "php /var/www/html/occ group:adduser users user1"
329+
- su www-data -c "php /var/www/html/occ group:adduser users user2"
330+
- su www-data -c "php /var/www/html/occ group:adduser users test"
331+
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/activity.git /var/www/html/apps/activity/"
332+
- su www-data -c "php /var/www/html/occ app:enable activity"
333+
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/text.git /var/www/html/apps/text/"
334+
- su www-data -c "php /var/www/html/occ app:enable text"
335+
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/end_to_end_encryption.git /var/www/html/apps/end_to_end_encryption/"
336+
- su www-data -c "php /var/www/html/occ app:enable end_to_end_encryption"
337+
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/password_policy.git /var/www/html/apps/password_policy/"
338+
- su www-data -c "php /var/www/html/occ app:enable password_policy"
339+
- su www-data -c "php /var/www/html/occ app:enable external"
340+
- su www-data -c 'php /var/www/html/occ config:app:set external sites --value="{\"1\":{\"id\":1,\"name\":\"Nextcloud\",\"url\":\"https:\/\/www.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false},\"2\":{\"id\":2,\"name\":\"Forum\",\"url\":\"https:\/\/help.nextcloud.com\",\"lang\":\"\",\"type\":\"link\",\"device\":\"\",\"icon\":\"external.svg\",\"groups\":[],\"redirect\":false}}"'
341+
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/groupfolders.git /var/www/html/apps/groupfolders/"
342+
- su www-data -c "php /var/www/html/occ app:enable -f groupfolders"
343+
- su www-data -c "php /var/www/html/occ groupfolders:create groupfolder"
344+
- su www-data -c "php /var/www/html/occ groupfolders:group 1 users"
345+
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/notifications.git /var/www/html/apps/notifications/"
346+
- su www-data -c "cd /var/www/html/apps/notifications"
347+
- su www-data -c "php /var/www/html/occ app:enable -f notifications"
348+
- su www-data -c "php /var/www/html/occ notification:generate test test"
349+
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/photos.git /var/www/html/apps/photos/"
350+
- su www-data -c "cd /var/www/html/apps/photos"
351+
- su www-data -c "php /var/www/html/occ app:enable -f photos"
352+
- su www-data -c "php /var/www/html/occ app:enable -f testing"
353+
- su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/recommendations.git /var/www/html/apps/recommendations/"
354+
- su www-data -c "php /var/www/html/occ app:enable recommendations"
355+
- su www-data -c "php /var/www/html/occ config:system:set ratelimit.protection.enabled --value false --type bool"
356+
- /usr/local/bin/run.sh
357+
358+
trigger:
359+
branch:
360+
- master
361+
- stable-*
362+
event:
363+
- push
364+
- pull_request
365+
---
251366
kind: signature
252-
hmac: d51bba0f9e5754b040cc2a99847a261a21e283074dabffa811f0c0eaf11f6968
367+
hmac: b26e47fc03b18d8521973aa42f47b82f98b0c61c1836a99e454e9792dbee02ae
253368

254369
...

library/src/androidTest/java/com/nextcloud/android/lib/resources/dashboard/DashboardGetWidgetItemsRemoteOperationIT.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class DashboardGetWidgetItemsRemoteOperationIT : AbstractIT() {
5252

5353
@Test
5454
fun getEmptyItems() {
55+
// only on NC25+
56+
testOnlyOnServer(NextcloudVersion.nextcloud_25)
57+
5558
val widgetId = "nonExistingWidget"
5659
val result =
5760
DashboardGetWidgetItemsRemoteOperation(widgetId, LIMIT_SIZE).execute(nextcloudClient)

library/src/androidTest/java/com/nextcloud/android/lib/resources/search/UnifiedSearchRemoteOperationIT.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import com.owncloud.android.AbstractIT
1111
import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation
1212
import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation
1313
import com.owncloud.android.lib.resources.files.model.RemoteFile
14+
import com.owncloud.android.lib.resources.status.NextcloudVersion
1415
import org.junit.Assert.assertEquals
1516
import org.junit.Assert.assertFalse
1617
import org.junit.Assert.assertNotNull
@@ -62,7 +63,10 @@ class UnifiedSearchRemoteOperationIT : AbstractIT() {
6263

6364
assertNotNull(firstResult)
6465
assertEquals(remotePath, firstResult?.remotePath())
65-
assertEquals(fileId.toString(), firstResult?.fileId())
66+
67+
if (isServerAtLeast(NextcloudVersion.nextcloud_21)) {
68+
assertEquals(fileId.toString(), firstResult?.fileId())
69+
}
6670
}
6771

6872
@Test

library/src/androidTest/java/com/owncloud/android/AbstractIT.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import com.owncloud.android.lib.resources.files.model.RemoteFile;
3737
import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation;
3838
import com.owncloud.android.lib.resources.status.GetStatusRemoteOperation;
39-
import com.owncloud.android.lib.resources.status.OCCapability;
4039
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
4140

4241
import org.apache.commons.httpclient.HttpStatus;
@@ -353,4 +352,14 @@ protected void testOnlyOnServer(OwnCloudVersion version) {
353352
assumeFalse(true);
354353
}
355354
}
355+
356+
protected boolean isServerAtLeast(OwnCloudVersion version) {
357+
final var result = new GetCapabilitiesRemoteOperation().execute(nextcloudClient);
358+
359+
if (result.isSuccess()) {
360+
return result.getResultData().getVersion().isNewerOrEqual(version);
361+
} else {
362+
return false;
363+
}
364+
}
356365
}

library/src/androidTest/java/com/owncloud/android/GetCapabilitiesRemoteOperationIT.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ private void checkCapability(OCCapability capability, String userId) {
165165

166166
@Test
167167
public void testClientIntegration() {
168+
// only on NC32+
169+
testOnlyOnServer(NextcloudVersion.nextcloud_32);
170+
168171
// get capabilities
169172
RemoteOperationResult<OCCapability> result = new GetCapabilitiesRemoteOperation().execute(nextcloudClient);
170173
assertTrue(result.isSuccess());

library/src/androidTest/java/com/owncloud/android/lib/resources/files/ReadFileRemoteOperationIT.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ class ReadFileRemoteOperationIT : AbstractIT() {
114114
val remoteFile = result.data[0] as RemoteFile
115115

116116
@Suppress("Detekt.MagicNumber")
117-
assertEquals(ImageDimension(451f, 529f), remoteFile.imageDimension)
117+
if (isServerAtLeast(NextcloudVersion.nextcloud_21)) {
118+
assertEquals(ImageDimension(451f, 529f), remoteFile.imageDimension)
119+
}
118120

119121
testOnlyOnServer(NextcloudVersion.nextcloud_27)
120122

library/src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationIT.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.owncloud.android.lib.resources.shares.CreateShareRemoteOperation;
2525
import com.owncloud.android.lib.resources.shares.ShareType;
2626
import com.owncloud.android.lib.resources.status.GetCapabilitiesRemoteOperation;
27+
import com.owncloud.android.lib.resources.status.NextcloudVersion;
2728
import com.owncloud.android.lib.resources.status.OCCapability;
2829

2930
import org.junit.BeforeClass;
@@ -200,7 +201,16 @@ public void favoriteFiles() throws IOException {
200201
assertEquals(2, result.getResultData().size());
201202

202203
assertEquals(remotePath, result.getResultData().get(0).getRemotePath());
203-
assertEquals(sharedRemotePath, result.getResultData().get(1).getRemotePath());
204+
205+
String expectedSharedRemotePath;
206+
if (isServerAtLeast(NextcloudVersion.nextcloud_21)) {
207+
expectedSharedRemotePath = sharedRemotePath;
208+
} else {
209+
// Bug: shared search ends with "/" even for files
210+
expectedSharedRemotePath = sharedRemotePath + "/";
211+
}
212+
assertEquals(expectedSharedRemotePath, result.getResultData().get(1).getRemotePath());
213+
204214
}
205215

206216
/**

library/src/androidTest/java/com/owncloud/android/lib/resources/users/DeleteE2ERemoteOperationIT.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@ package com.owncloud.android.lib.resources.users
99

1010
import com.owncloud.android.AbstractIT
1111
import com.owncloud.android.lib.resources.e2ee.DeleteEncryptedFilesRemoteOperation
12+
import com.owncloud.android.lib.resources.status.NextcloudVersion
1213
import junit.framework.TestCase.assertTrue
14+
import org.junit.Before
1315
import org.junit.Test
1416

1517
class DeleteE2ERemoteOperationIT : AbstractIT() {
18+
@Before
19+
fun before() {
20+
testOnlyOnServer(NextcloudVersion.nextcloud_34)
21+
}
22+
1623
@Test
1724
fun testDeleteEncryptedFiles() {
1825
val sut = DeleteEncryptedFilesRemoteOperation()

library/src/androidTest/java/com/owncloud/android/lib/resources/users/StatusIT.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
package com.owncloud.android.lib.resources.users
99

1010
import com.owncloud.android.AbstractIT
11+
import com.owncloud.android.lib.resources.status.NextcloudVersion
1112
import com.owncloud.android.lib.resources.status.OwnCloudVersion
1213
import org.junit.Assert.assertEquals
1314
import org.junit.Assert.assertTrue
@@ -40,7 +41,13 @@ class StatusIT : AbstractIT() {
4041
val result0 = SetStatusRemoteOperation(StatusType.ONLINE).execute(nextcloudClient)
4142
assertTrue("SetStatusRemoteOperation failed: " + result0.logMessage, result0.isSuccess)
4243

43-
for (statusType in StatusType.values()) {
44+
val status = StatusType.entries.toMutableList()
45+
46+
if (!isServerAtLeast(NextcloudVersion.nextcloud_21)) {
47+
status.remove(StatusType.BUSY)
48+
}
49+
50+
for (statusType in status) {
4451
val result1 = GetStatusRemoteOperation().run(nextcloudClient)
4552
assertTrue("GetStatusRemoteOperation failed: " + result1.logMessage, result1.isSuccess)
4653

0 commit comments

Comments
 (0)