From 35738a5579a2e3048726ebfb2f10e9cd08ae02eb Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 4 Apr 2017 21:42:26 -0700 Subject: [PATCH] setup appdata directory fixes #3 and #4 --- Dockerfile | 1 - app.ini.template | 30 ++++++++++++++++++++++++------ start.sh | 2 ++ test/test.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 86eb1c1..249203d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,6 @@ RUN cd /home/git/gogs && \ # setup config paths ADD app.ini.template /home/git/app.ini.template -RUN mkdir -p /run/gogs && chown -R git:git /run/gogs # setup log paths RUN mkdir -p /run/gogs && chown -R git:git /run/gogs diff --git a/app.ini.template b/app.ini.template index 03b5c8a..156a581 100644 --- a/app.ini.template +++ b/app.ini.template @@ -11,10 +11,6 @@ PASSWD = ##MYSQL_PASSWORD SSL_MODE = disable PATH = -[repository] -ROOT = /app/data/repository -SCRIPT_TYPE = bash - [server] PROTOCOL = http DOMAIN = ##DOMAIN @@ -23,9 +19,23 @@ HTTP_ADDR = HTTP_PORT = 3000 DISABLE_SSH = ##DISABLE_SSH SSH_PORT = ##SSH_PORT +APP_DATA_PATH = /app/data/appdata ; Landing page for non-logged users, can be "home" or "explore" LANDING_PAGE = explore +[repository] +ROOT = /app/data/repository +SCRIPT_TYPE = bash + +[repository.upload] +ENABLED = true +TEMP_PATH = /run/gogs/tmp/uploads + +[release.attachment] +ENABLED = true +; APP_DATA_PATH/attachments +PATH = + [mailer] ENABLED = true HOST = ##MAIL_SERVER:##MAIL_PORT @@ -34,8 +44,6 @@ PASSWD = ##MAIL_SMTP_PASSWORD FROM = ##MAIL_FROM SKIP_VERIFY = true -[admin] - [security] INSTALL_LOCK = true SECRET_KEY = ##SECRET_KEY @@ -51,4 +59,14 @@ MODE = console ; used for xorm.log ROOT_PATH = /run/gogs +[picture] +; APP_DATA_PATH/avatars +AVATAR_UPLOAD_PATH = +GRAVATAR_SOURCE = gravatar +DISABLE_GRAVATAR = false + +[attachment] +ENABLE = true +; APP_DATA_PATH/attachments +PATH = diff --git a/start.sh b/start.sh index b65a722..34b0695 100755 --- a/start.sh +++ b/start.sh @@ -2,6 +2,8 @@ set -eu -o pipefail +mkdir -p /run/gogs/tmp/uploads + setup_ldap_source() { set -eu diff --git a/test/test.js b/test/test.js index 4b2c569..0d96ac5 100755 --- a/test/test.js +++ b/test/test.js @@ -55,6 +55,45 @@ describe('Application life cycle test', function () { done(); }); + function waitForUrl(url, done) { + browser.wait(function () { + return browser.getCurrentUrl().then(function (currentUrl) { + return currentUrl === url; + }); + }, TIMEOUT).then(function () { done(); }); + } + + function setAvatar(done) { + browser.get('https://' + app.fqdn + '/user/settings/avatar'); + + browser.findElement(by.xpath('//input[@type="file" and @name="avatar"]')).sendKeys(path.resolve(__dirname, '../logo.png')).then(function () { + browser.findElement(by.xpath('//button[contains(text(), "Update Avatar Setting")]')).click(); + + browser.wait(until.elementLocated(by.xpath('//p[contains(text(),"updated successfully")]')), TIMEOUT).then(function () { done(); }); + }); + } + + function checkAvatar(done) { + superagent.get('https://' + app.fqdn + '/avatars/1').end(function (error, result) { + expect(error).to.be(null); + expect(result.statusCode).to.be(200); + done(); + }); + } + + function editFile(done) { + browser.get('https://' + app.fqdn + '/' + username + '/' + reponame + '/_edit/master/newfile'); + + var cm = browser.findElement(by.xpath('//div[contains(@class,"CodeMirror")]')); + var text = 'yo'; + browser.executeScript('arguments[0].CodeMirror.setValue("' + text + '");', cm).then(function () { + browser.findElement(by.xpath('//input[@name="commit_summary"]')).sendKeys('Dummy edit'); + browser.findElement(by.xpath('//button[contains(text(), "Commit Changes")]')).click(); + + waitForUrl('https://' + app.fqdn + '/' + username + '/' + reponame + '/src/master/newfile', done); + }); + } + xit('build app', function () { execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); }); @@ -112,6 +151,9 @@ describe('Application life cycle test', function () { browser.wait(until.elementLocated(by.linkText('Dashboard')), TIMEOUT).then(function () { done(); }); }); + it('can set avatar', setAvatar); + it('can get avatar', checkAvatar); + it('can add public key', function (done) { browser.get('https://' + app.fqdn + '/user/settings/ssh'); var publicKey = fs.readFileSync(__dirname + '/id_rsa.pub', 'utf8'); @@ -162,6 +204,8 @@ describe('Application life cycle test', function () { done(); }); + it('can edit file', editFile); + it('can restart app', function (done) { execSync('cloudron restart'); done(); @@ -184,6 +228,8 @@ describe('Application life cycle test', function () { execSync('cloudron restore --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); }); + it('can get avatar', checkAvatar); + it('can clone the url', function (done) { var env = Object.create(process.env); env.GIT_SSH = __dirname + '/git_ssh_wrapper.sh'; @@ -209,6 +255,8 @@ describe('Application life cycle test', function () { browser.wait(until.elementLocated(by.linkText('Dashboard')), TIMEOUT).then(function () { done(); }); }); + it('can get avatar', checkAvatar); + it('displays correct clone url', function (done) { browser.get('https://' + app.fqdn + '/' + username + '/' + reponame); browser.findElement(by.id('repo-clone-ssh')).click();