Skip to content

Commit

Permalink
attempt to fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
  • Loading branch information
julien-nc committed Sep 12, 2024
1 parent 02265af commit 5fa6c47
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
fail-fast: false
matrix:
php-versions: [ '8.1' ]
server-versions: [ 'master', 'stable29', 'stable28' ]
#server-versions: [ 'stable30', 'stable29', 'stable28' ]
server-versions: [ 'stable30' ]

name: Integration test

Expand All @@ -42,7 +43,7 @@ jobs:
with:
path: server
repository: nextcloud/server
ref:
ref: ${{ matrix.server-versions }}

- name: Checkout app
uses: actions/checkout@v3
Expand Down Expand Up @@ -81,19 +82,24 @@ jobs:
working-directory: server/
env:
DROPBOX_CONFIG: ${{ secrets.DROPBOX_CONFIG }}
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
run: |
echo $DROPBOX_CONFIG > config.json
sudo apt install jq sqlite3
sqlite3 data/owncloud.db "INSERT INTO oc_preferences ( userid, appid, configkey, configvalue) VALUES ('admin', 'integration_dropbox', 'account_id', $(cat config.json | jq '.config.account_id'));"
sqlite3 data/owncloud.db "INSERT INTO oc_preferences ( userid, appid, configkey, configvalue) VALUES ('admin', 'integration_dropbox', 'token', $(cat config.json | jq '.config.token'));"
sqlite3 data/owncloud.db "INSERT INTO oc_preferences ( userid, appid, configkey, configvalue) VALUES ('admin', 'integration_dropbox', 'refresh_token', $(cat config.json | jq '.config.refresh_token'));"
sqlite3 data/owncloud.db "INSERT INTO oc_preferences ( userid, appid, configkey, configvalue) VALUES ('admin', 'integration_dropbox', 'importing_dropbox', '1');"
sqlite3 data/owncloud.db "INSERT INTO oc_appconfig ( appid, configkey, configvalue) VALUES ('integration_dropbox', 'client_id', '$OAUTH_CLIENT_ID');"
sqlite3 data/owncloud.db "INSERT INTO oc_appconfig ( appid, configkey, configvalue) VALUES ('integration_dropbox', 'client_secret', '$OAUTH_CLIENT_SECRET');"
- name: Run import
working-directory: server/
run: |
php occ integration_dropbox:start-import admin
for run in {1..10}; do php cron.php; done
for run in {1..10}; do date; echo "run $run starting"; php cron.php; ls -lh data/admin/files/Dropbox\ import/ ; echo "run $run done"; done
date
- name: Check import result
working-directory: server/
Expand All @@ -108,10 +114,12 @@ jobs:
EOM
diff result.expected.txt result.txt
cat > du-sh.expected.txt <<- EOM
1.5G data/admin/files/Dropbox import/
1.6G data/admin/files/Dropbox import/
EOM
echo CHECK
du -sh data/admin/files/Dropbox\ import/*
echo END CHECK
du -sh data/admin/files/Dropbox\ import/ | diff du-sh.expected.txt -
- name: Show log on failure
working-directory: server/
Expand Down
2 changes: 1 addition & 1 deletion lib/Command/StartImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function configure() {
*/
protected function execute(InputInterface $input, OutputInterface $output): int {
try {
$this->dropboxStorageAPIService->importDropboxJob($input->getArgument('user_id'));
$this->dropboxStorageAPIService->startImportDropbox($input->getArgument('user_id'));
} catch (\Exception $ex) {
$output->writeln('<error>Failed to start import</error>');
$output->writeln($ex->getMessage());
Expand Down
4 changes: 4 additions & 0 deletions lib/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function setConfig(array $values): DataResponse {
$this->config->deleteUserValue($this->userId, Application::APP_ID, 'user_name');
$this->config->deleteUserValue($this->userId, Application::APP_ID, 'uid');
$this->config->deleteUserValue($this->userId, Application::APP_ID, 'account_id');
$this->config->deleteUserValue($this->userId, Application::APP_ID, 'email');
$this->config->deleteUserValue($this->userId, Application::APP_ID, 'token');
$this->config->deleteUserValue($this->userId, Application::APP_ID, 'refresh_token');
}
Expand Down Expand Up @@ -123,6 +124,9 @@ public function submitAccessCode(string $code = ''): DataResponse {
if (isset($result['email'])) {
$this->config->setUserValue($this->userId, Application::APP_ID, 'email', $result['email']);
$data['email'] = $result['email'];
} elseif (isset($info['email'])) {
$this->config->setUserValue($this->userId, Application::APP_ID, 'email', $info['email']);
$data['email'] = $info['email'];
}
if (isset($info['name'], $info['name']['display_name'])) {
$this->config->setUserValue($this->userId, Application::APP_ID, 'user_name', $info['name']['display_name']);
Expand Down
2 changes: 2 additions & 0 deletions src/components/PersonalSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ export default {
methods: {
onLogoutClick() {
this.state.user_name = ''
this.state.email = null
this.state.account_id = null
this.saveOptions({ user_name: this.state.user_name })
},
onAccessCodeInput() {
Expand Down
1 change: 1 addition & 0 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
</file>
<file src="lib/Controller/ConfigController.php">
<InvalidArrayOffset>
<code><![CDATA[$info['email']]]></code>
<code><![CDATA[$info['name']]]></code>
<code><![CDATA[$info['name']]]></code>
</InvalidArrayOffset>
Expand Down

0 comments on commit 5fa6c47

Please sign in to comment.