Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
PUBLIC
/
surfer-okd
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ebd7ed7a
authored
Nov 27, 2015
by
Girish Ramakrishnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cloudron tests
1 parent
20826700
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
0 deletions
README.md
package.json
test/test.js
README.md
View file @
ebd7ed7
...
...
@@ -42,3 +42,14 @@ Put some files:
surfer put [file]
## Testing
The e2e tests are located in the
`test/`
folder and require
[
nodejs
](
http://nodejs.org/
)
. They are creating a fresh build, install the app on your Cloudron, perform tests, backup, restore and test if the files are still ok.
```
cd surfer/test
npm install
USERNAME=<cloudron username> PASSWORD=<cloudron password> mocha --bail test.js
```
package.json
View file @
ebd7ed7
...
...
@@ -39,5 +39,10 @@
"safetydance"
:
"0.0.16"
,
"superagent"
:
"^1.2.0"
,
"underscore"
:
"^1.8.3"
},
"devDependencies"
:
{
"expect.js"
:
"^0.3.1"
,
"mocha"
:
"^2.3.4"
,
"rimraf"
:
"^2.4.4"
}
}
test/test.js
0 → 100755
View file @
ebd7ed7
#!/usr/bin/env node
'use strict'
;
var
execSync
=
require
(
'child_process'
).
execSync
,
expect
=
require
(
'expect.js'
),
path
=
require
(
'path'
),
superagent
=
require
(
'superagent'
);
process
.
env
.
NODE_TLS_REJECT_UNAUTHORIZED
=
'0'
;
describe
(
'Application life cycle test'
,
function
()
{
this
.
timeout
(
0
);
var
LOCATION
=
'surfertest'
;
var
app
;
var
username
=
process
.
env
.
USERNAME
;
var
password
=
process
.
env
.
PASSWORD
;
before
(
function
(
done
)
{
if
(
!
process
.
env
.
USERNAME
)
return
done
(
new
Error
(
'USERNAME env var not set'
));
if
(
!
process
.
env
.
PASSWORD
)
return
done
(
new
Error
(
'PASSWORD env var not set'
));
done
();
});
after
(
function
(
done
)
{
done
();
});
xit
(
'build app'
,
function
()
{
execSync
(
'cloudron build'
,
{
cwd
:
path
.
resolve
(
__dirname
,
'..'
),
stdio
:
'inherit'
});
});
it
(
'install app'
,
function
()
{
execSync
(
'cloudron install --new --location '
+
LOCATION
,
{
cwd
:
path
.
resolve
(
__dirname
,
'..'
),
stdio
:
'inherit'
});
});
it
(
'can get app information'
,
function
()
{
var
inspect
=
JSON
.
parse
(
execSync
(
'cloudron inspect'
));
app
=
inspect
.
apps
.
filter
(
function
(
a
)
{
return
a
.
location
===
LOCATION
;
})[
0
];
expect
(
app
).
to
.
be
.
an
(
'object'
);
});
it
(
'can get the main page'
,
function
(
done
)
{
superagent
.
get
(
'https://'
+
app
.
fqdn
).
end
(
function
(
error
,
result
)
{
expect
(
error
).
to
.
be
(
null
);
expect
(
result
.
status
).
to
.
eql
(
200
);
done
();
});
});
it
(
'can login using cli'
,
function
(
done
)
{
execSync
(
__dirname
+
'../cli/surfer.js login https://'
+
app
.
fqdn
,
{
input
:
username
+
'\n'
+
password
+
'\n'
});
done
();
});
it
(
'can upload file'
,
function
(
done
)
{
execSync
(
__dirname
+
'../cli/surfer.js put test.js'
);
done
();
});
it
(
'backup app'
,
function
()
{
execSync
(
'cloudron backup --app '
+
app
.
id
,
{
cwd
:
path
.
resolve
(
__dirname
,
'..'
),
stdio
:
'inherit'
});
});
it
(
'restore app'
,
function
()
{
execSync
(
'cloudron restore --app '
+
app
.
id
,
{
cwd
:
path
.
resolve
(
__dirname
,
'..'
),
stdio
:
'inherit'
});
});
it
(
'can get the uploaded file'
,
function
(
done
)
{
var
testFile
=
execSync
(
__dirname
+
'../cli/surfer.js get test.js'
).
toString
(
'utf8'
);
console
.
log
(
testFile
);
done
();
});
xit
(
'uninstall app'
,
function
()
{
execSync
(
'cloudron uninstall --app '
+
app
.
id
,
{
cwd
:
path
.
resolve
(
__dirname
,
'..'
),
stdio
:
'inherit'
});
});
});
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment