-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more extensive test for AutoRenamer (#101)
* Add more extensive test Signed-off-by: Milen Pivchev <[email protected]> * Force check Signed-off-by: Milen Pivchev <[email protected]> * Revert "Force check" This reverts commit b7fadf6. * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> * WIP Signed-off-by: Milen Pivchev <[email protected]> --------- Signed-off-by: Milen Pivchev <[email protected]> Co-authored-by: Marino Faggiana <[email protected]>
- Loading branch information
1 parent
1c4389d
commit a5b6f5c
Showing
8 changed files
with
409 additions
and
229 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
name: Build and test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
types: [synchronize, opened, reopened, ready_for_review] | ||
branches: | ||
- master | ||
- develop | ||
|
||
env: | ||
DESTINATION_IOS: platform=iOS Simulator,name=iPhone 16,OS=18.1 | ||
DESTINATION_MACOS: platform=macOS,arch=x86_64 | ||
SCHEME: NextcloudKit | ||
SERVER_BRANCH: stable28 | ||
PHP_VERSION: 8.2 | ||
|
||
jobs: | ||
build-and-test: | ||
name: Build and Test | ||
runs-on: macos-15 | ||
if: github.event.pull_request.draft == false | ||
steps: | ||
- name: Set env var | ||
run: echo "DEVELOPER_DIR=$(xcode-select --print-path)" >> $GITHUB_ENV | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up php ${{ env.PHP_VERSION }} | ||
uses: shivammathur/setup-php@8872c784b04a1420e81191df5d64fbd59d3d3033 # v2.30.0 | ||
with: | ||
php-version: ${{ env.PHP_VERSION }} | ||
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation | ||
extensions: apcu, bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql | ||
coverage: none | ||
ini-file: development | ||
# Temporary workaround for missing pcntl_* in PHP 8.3: ini-values: apc.enable_cli=on | ||
ini-values: apc.enable_cli=on, disable_functions= | ||
|
||
- name: Checkout server | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
submodules: true | ||
repository: nextcloud/server | ||
path: server | ||
ref: ${{ env.SERVER_BRANCH }} | ||
|
||
- name: Set up Nextcloud | ||
run: | | ||
mkdir server/data | ||
./server/occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin | ||
./server/occ config:system:set hashing_default_password --value=true --type=boolean | ||
./server/occ config:system:set auth.bruteforce.protection.enabled --value false --type bool | ||
./server/occ config:system:set ratelimit.protection.enabled --value false --type bool | ||
./server/occ config:system:set memcache.local --value="\\OC\\Memcache\\APCu" | ||
./server/occ config:system:set memcache.distributed --value="\\OC\\Memcache\\APCu" | ||
./server/occ background:cron | ||
PHP_CLI_SERVER_WORKERS=5 php -S localhost:8080 -t server/ & | ||
# - name: Setup Bundler and Install Gems | ||
# run: | | ||
# gem install bundler | ||
# bundle install | ||
# bundle update | ||
# - name: Install docker | ||
# run: | | ||
# # Workaround for https://github.com/actions/runner-images/issues/8104 | ||
# brew remove --ignore-dependencies qemu | ||
# curl -o ./qemu.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/dc0669eca9479e9eeb495397ba3a7480aaa45c2e/Formula/qemu.rb | ||
# brew install ./qemu.rb | ||
# | ||
# brew install docker | ||
# colima start | ||
# - name: Create docker test server and export enviroment variables | ||
# run: | | ||
# source ./create-docker-test-server.sh | ||
# if [ ! -f ".env-vars" ]; then | ||
# touch .env-vars | ||
# echo "export TEST_SERVER_URL=$TEST_SERVER_URL" >> .env-vars | ||
# echo "export TEST_USER=$TEST_USER" >> .env-vars | ||
# echo "export TEST_APP_PASSWORD=$TEST_APP_PASSWORD" >> .env-vars | ||
# fi | ||
# - name: Generate EnvVars file | ||
# run: | | ||
# ./generate-env-vars.sh | ||
- name: Build & Test NextcloudKit | ||
run: | | ||
set -o pipefail && xcodebuild test -scheme "$SCHEME" \ | ||
-destination "$DESTINATION_IOS" \ | ||
-test-iterations 3 \ | ||
-retry-tests-on-failure \ | ||
| xcpretty | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
Tests/NextcloudKitIntegrationTests/Common/BaseXCTestCase.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2024 Milen Pivchev | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import XCTest | ||
import Foundation | ||
import UIKit | ||
import Alamofire | ||
import NextcloudKit | ||
|
||
class BaseXCTestCase: XCTestCase { | ||
var appToken = "" | ||
|
||
func setupAppToken() { | ||
let expectation = expectation(description: "Should get app token") | ||
|
||
NextcloudKit.shared.getAppPassword(url: TestConstants.server, user: TestConstants.username, password: TestConstants.password) { token, _, error in | ||
XCTAssertEqual(error.errorCode, 0) | ||
XCTAssertNotNil(token) | ||
|
||
guard let token else { return XCTFail() } | ||
|
||
self.appToken = token | ||
expectation.fulfill() | ||
} | ||
|
||
waitForExpectations(timeout: TestConstants.timeoutLong) | ||
} | ||
|
||
override func setUpWithError() throws { | ||
setupAppToken() | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
Tests/NextcloudKitIntegrationTests/Common/TestConstants.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2024 Milen Pivchev | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
public class TestConstants { | ||
static let timeoutLong: Double = 400 | ||
static let server = "http://localhost:8080" | ||
static let username = "admin" | ||
static let password = "admin" | ||
static let account = "\(username) \(server)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.