Skip to content

Commit a19c1ef

Browse files
committed
ci: update config
stash changes stash changes stash changes stash changes stash changes stash changes stash changes stash changes stash changes
1 parent b0fc37a commit a19c1ef

File tree

6 files changed

+61
-49
lines changed

6 files changed

+61
-49
lines changed

.github/workflows/test.yml

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -50,44 +50,6 @@ jobs:
5050
pip install -r ./tests/ci/requirements.txt
5151
./tests/ci/api-test.py
5252
53-
playwright-test-tmp:
54-
runs-on: ubuntu-latest
55-
timeout-minutes: 5
56-
57-
strategy:
58-
matrix:
59-
node-version: [22.x]
60-
61-
steps:
62-
- uses: actions/checkout@v4
63-
64-
- name: Use Node.js ${{ matrix.node-version }}
65-
uses: actions/setup-node@v4
66-
with:
67-
node-version: ${{ matrix.node-version }}
68-
69-
- name: Install dependencies
70-
run: npm install
71-
72-
- name: Install dependencies (playwright)
73-
run: npm install
74-
working-directory: ./tests/playwright
75-
76-
- name: Install Playwright Browsers
77-
run: npx playwright install --with-deps
78-
working-directory: ./tests/playwright
79-
80-
- name: Run Playwright tests
81-
run: npx playwright test
82-
working-directory: ./tests/playwright
83-
84-
- uses: actions/upload-artifact@v4
85-
if: ${{ !cancelled() }}
86-
with:
87-
name: playwright-report-tmp
88-
path: tests/playwright/playwright-report/
89-
retention-days: 30
90-
9153
playwright-test:
9254
runs-on: ubuntu-latest
9355
timeout-minutes: 10
@@ -112,9 +74,25 @@ jobs:
11274
- uses: actions/upload-artifact@v4
11375
if: ${{ !cancelled() }}
11476
with:
115-
name: playwright-report
77+
name: server-logs
11678
path: |
117-
tests/playwright/playwright-report/
11879
/tmp/backend.log
11980
/tmp/fs-tree-manager.log
120-
retention-days: 30
81+
retention-days: 3
82+
83+
- uses: actions/upload-artifact@v4
84+
if: ${{ !cancelled() }}
85+
with:
86+
name: config-files
87+
path: |
88+
./volatile/config/config.json
89+
./src/fs_tree_manager/config.yaml
90+
./tests/client-config.yaml
91+
retention-days: 3
92+
93+
- uses: actions/upload-artifact@v4
94+
if: ${{ !cancelled() }}
95+
with:
96+
name: playwright-report
97+
path: tests/playwright/playwright-report/
98+
retention-days: 3

src/backend/src/modules/web/WebServerService.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,12 @@ class WebServerService extends BaseService {
276276
}
277277
});
278278

279+
console.log('[xiaochen-debug] socketio.use done');
280+
279281
const context = Context.get();
280282
socketio.on('connection', (socket) => {
283+
console.log('[xiaochen-debug] socketio.on connection handler done');
284+
281285
socket.on('disconnect', () => {
282286
});
283287
socket.on('trash.is_empty', (msg) => {
@@ -293,13 +297,15 @@ class WebServerService extends BaseService {
293297
socket.on(replicaFetchHandler.event, (data) => {
294298
replicaFetchHandler.handler(socket, data);
295299
});
300+
console.log('[xiaochen-debug] event registered: replica/fetch');
296301
}
297302

298303
const replicaPullDiffHandler = require('../../routers/filesystem_api/fs_tree_manager/pull_diff');
299304
if (replicaPullDiffHandler.event && replicaPullDiffHandler.handler) {
300305
socket.on(replicaPullDiffHandler.event, (data) => {
301306
replicaPullDiffHandler.handler(socket, data);
302307
});
308+
console.log('[xiaochen-debug] event registered: replica/pull_diff');
303309
}
304310
}
305311

src/backend/src/routers/filesystem_api/fs_tree_manager/fetch_replica.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const { Context } = require('../../../util/context');
2727
module.exports = {
2828
event: 'replica/fetch',
2929
handler: async (socket, _data) => {
30+
console.log('[xiaochen-debug] fetch_replica.handler, socket:', socket);
31+
3032
// const svc_permission = Context.get('services').get('permission');
3133
// const can_access = await svc_permission.check('endpoint:replica/fetch');
3234
// if ( ! can_access ) {
@@ -43,7 +45,7 @@ module.exports = {
4345
} = require('./common');
4446

4547
const client = getClient();
46-
if ( !client ) {
48+
if (!client) {
4749
// Client-replica service is not available
4850
return socket.emit('replica/fetch/error', {
4951
success: false,
@@ -56,7 +58,7 @@ module.exports = {
5658
requestMsg.setUserId(socket.user.id);
5759

5860
client.fetchReplica(requestMsg, (err, resp) => {
59-
if ( err ) {
61+
if (err) {
6062
console.error(`FetchReplica error: ${err.message}`);
6163
return socket.emit('replica/fetch/error', {
6264
success: false,

src/puter-js/src/modules/FileSystem/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ export class PuterJSFileSystemModule extends AdvancedBase {
216216
* @returns {void}
217217
*/
218218
setAuthToken(authToken) {
219+
console.log('[xiaochen-debug] FileSystem.setAuthToken', authToken);
220+
219221
this.authToken = authToken;
220222

221223
// Check cache timestamp and purge if needed (only in GUI environment)

tests/ci/playwright-test.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def get_token():
4949
"Content-Type": "application/json",
5050
"Accept": "application/json",
5151
"Origin": "http://api.puter.localhost:4100",
52+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36",
5253
},
5354
json=login_data,
5455
timeout=30,
@@ -134,6 +135,8 @@ def init_fs_tree_manager_config():
134135
with open(config_path, "w") as f:
135136
yaml.dump(config, f, default_flow_style=False, indent=2)
136137

138+
print(f"fs-tree-manager config initialized at {config_path}")
139+
137140

138141
def init_client_config():
139142
example_config_path = f"{os.getcwd()}/tests/example-client-config.yaml"
@@ -193,6 +196,8 @@ def run():
193196
# =========================================================================
194197
# start fs-tree-manager server
195198
# =========================================================================
199+
init_fs_tree_manager_config()
200+
196201
cxc_toolkit.exec.run_background(
197202
"go run server.go",
198203
work_dir=f"{PUTER_ROOT}/src/fs_tree_manager",
@@ -214,7 +219,9 @@ def run():
214219
)
215220

216221
cxc_toolkit.exec.run_command(
217-
"npx playwright test --reporter=line",
222+
"npx playwright test",
223+
# "npx playwright test --reporter=line",
224+
# "npx playwright test --reporter=github",
218225
work_dir=f"{PUTER_ROOT}/tests/playwright",
219226
)
220227

tests/playwright/tests/client-replica.spec.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,33 @@ async function bootstrap(page: import('@playwright/test').Page) {
1717
await page.evaluate(({ api_url, auth_token }) => {
1818
const puter = (window as any).puter;
1919
return (async () => {
20+
console.log('[xiaochen-debug] puter.setAPIOrigin', api_url);
21+
console.log('[xiaochen-debug] puter.setAuthToken', auth_token);
22+
2023
await puter.setAPIOrigin(api_url);
2124
await puter.setAuthToken(auth_token);
25+
26+
console.log('[xiaochen-debug] puter.fs.setAPIOrigin', api_url);
27+
console.log('[xiaochen-debug] puter.fs.setAuthToken', auth_token);
28+
29+
await puter.fs.setAPIOrigin(api_url);
30+
await puter.fs.setAuthToken(auth_token);
31+
32+
// sleep 10 seconds
33+
await new Promise(resolve => setTimeout(resolve, 10_000));
34+
35+
console.log('[xiaochen-debug] puter.fs.replica.available, point 1', puter.fs.replica.available);
2236
})();
2337
}, { api_url: testConfig.api_url, auth_token: testConfig.auth_token });
2438

25-
// Wait for replica to be available.
26-
await page.waitForFunction(() => {
27-
const puter = (window as any).puter;
28-
return puter?.fs?.replica?.available === true;
29-
}, null, { timeout: 10_000 });
39+
// // Wait for replica to be available.
40+
// await page.waitForFunction(() => {
41+
// const puter = (window as any).puter;
42+
43+
// console.log('[xiaochen-debug] puter.fs.replica.available, point 2 ', puter?.fs?.replica?.available);
44+
45+
// return puter?.fs?.replica?.available === true;
46+
// }, null, { timeout: 10_000 });
3047
}
3148

3249
test('multi-session - mkdir', async ({ browser }) => {

0 commit comments

Comments
 (0)