4a05b7c8d5
* [MM-39852] Setup docker image to run in CI for E2E * Setup remote docker * Install docker * Trying this * And this * how about this * this * Okay this * dis one * sdfsagsdags * Now? * aaaaaaa * asdasdasd * i am dumb * blank * Please work * Lint fix * Forgot to update a couple things * OOPS * Testing something since this one is still failing * Trying robotjs instead * test * Remove stop docker * Try without the admin user (since apparently turning off admin notices didn't work) * Remove console statement Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
60 lines
2.3 KiB
JavaScript
60 lines
2.3 KiB
JavaScript
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
const {spawn, exec} = require('child_process');
|
|
|
|
const axios = require('axios');
|
|
|
|
const mmctlPath = process.env.MMCTL_PATH || 'mmctl';
|
|
|
|
const ping = setInterval(async () => {
|
|
try {
|
|
const pingRequest = await axios.get('http://localhost:8065/api/v4/system/ping');
|
|
if (pingRequest.status === 200) {
|
|
const addUserRequest = await axios.post(
|
|
'http://localhost:8065/api/v4/users',
|
|
{
|
|
email: 'test@test.com',
|
|
username: 'admin1',
|
|
password: 'Sys@dmin123',
|
|
allow_marketing: false,
|
|
});
|
|
if (addUserRequest.status === 201) {
|
|
clearInterval(ping);
|
|
|
|
exec('echo "Sys@dmin123" > passfile', () => {
|
|
const mmctlauth = spawn(mmctlPath, ['auth', 'login', 'http://localhost:8065', '--name', 'local-server', '--username', 'admin1', '--password-file', 'passfile']);
|
|
mmctlauth.stdout.on('data', (data) => {
|
|
console.log(`${data}`);
|
|
});
|
|
|
|
mmctlauth.stderr.on('data', (data) => {
|
|
console.log(`ERROR: ${data}`);
|
|
});
|
|
|
|
mmctlauth.on('close', () => {
|
|
const sampledata = spawn(mmctlPath, ['sampledata']);
|
|
sampledata.stdout.on('data', (data) => {
|
|
console.log(`${data}`);
|
|
});
|
|
|
|
sampledata.stderr.on('data', (data) => {
|
|
console.log(`ERROR: ${data}`);
|
|
});
|
|
|
|
sampledata.on('close', () => {
|
|
exec(`${mmctlPath} config set AnnouncementSettings.UserNoticesEnabled false`, (err, stdout, stderr) => {
|
|
console.log(err, stdout, stderr);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
} else {
|
|
console.log(`ERROR: Trying to contact server, got ${pingRequest.status}`);
|
|
}
|
|
} catch {
|
|
console.log('waiting for server to respond...');
|
|
}
|
|
}, 1000);
|