Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
debomatic-webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
debomatic-webui-admins
debomatic-webui
Commits
a64dd5ee
Commit
a64dd5ee
authored
Jul 20, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use fucking done() to wait for conclusion - avoid false positive
parent
2e503eaf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
22 deletions
+36
-22
debomatic-webui/test/tests.coffee
debomatic-webui/test/tests.coffee
+36
-22
No files found.
debomatic-webui/test/tests.coffee
View file @
a64dd5ee
...
@@ -11,6 +11,7 @@ should = require('should')
...
@@ -11,6 +11,7 @@ should = require('should')
server
=
null
server
=
null
exec
=
(
c
)
->
exec
=
(
c
)
->
c
=
c
.
replace
(
'"'
,
'
\"
'
)
exec_orig
(
"echo '
#{
c
}
' >> commands.log"
)
exec_orig
(
"echo '
#{
c
}
' >> commands.log"
)
exec_orig
(
c
)
exec_orig
(
c
)
...
@@ -44,10 +45,10 @@ class Helper
...
@@ -44,10 +45,10 @@ class Helper
append_file
:
(
distribution
,
debpack
,
extension
,
data
)
->
append_file
:
(
distribution
,
debpack
,
extension
,
data
)
->
file_path
=
path
.
join
(
@
base
,
distribution
,
'pool'
,
debpack
,
debpack
)
+
'.'
+
extension
file_path
=
path
.
join
(
@
base
,
distribution
,
'pool'
,
debpack
,
debpack
)
+
'.'
+
extension
@
make_package
(
distribution
,
debpack
)
@
make_package
(
distribution
,
debpack
)
exec
(
"echo
#{
data
}
>>
#{
file_path
}
"
)
exec
(
"echo
'
#{
data
}
'
>>
#{
file_path
}
"
)
append_json
:
(
data
)
->
append_json
:
(
data
)
->
exec
(
"echo
#{
data
}
>>
#{
@
json
}
"
)
exec
(
"echo
'
#{
data
}
'
>>
#{
@
json
}
"
)
clean
:
(
distribution
,
debpack
,
file_extension
)
->
clean
:
(
distribution
,
debpack
,
file_extension
)
->
b_path
=
@
base
b_path
=
@
base
...
@@ -79,93 +80,106 @@ class Helper
...
@@ -79,93 +80,106 @@ class Helper
helper
=
new
Helper
()
helper
=
new
Helper
()
launch_server
()
if
process
.
env
.
SERVER
client
=
null
client
=
null
options
=
transports
:
[
'websocket'
],
'force new connection'
:
true
describe
'client'
,
->
describe
'client'
,
->
before
(
->
before
(
(
done
)
->
launch_server
()
if
process
.
env
.
SERVER
helper
.
append_json
(
'{"status": "build", "package": "test_1.2.3", "distribution": "unstable"}'
)
helper
.
make_distribution
(
'trusty'
)
helper
.
make_distribution
(
'trusty'
)
helper
.
make_distribution
(
'unstable'
)
helper
.
make_distribution
(
'unstable'
)
helper
.
append_json
(
'{"status": "build", "package": "test_1.2.3", "uploader": "", "distribution": "unstable"}'
)
done
(
)
)
)
beforeEach
(
->
beforeEach
(
(
done
)
->
client
=
io
.
connect
(
"http://
#{
config
.
host
}
:
#{
config
.
port
}
"
)
client
=
io
.
connect
(
"http://
#{
config
.
host
}
:
#{
config
.
port
}
"
,
options
)
client
.
once
'connect'
,
->
done
()
)
)
afterEach
(
->
afterEach
(
(
done
)
->
client
.
disconnect
()
client
.
disconnect
()
done
()
)
)
it
'get distributions'
,
(
done
)
->
it
'get distributions'
,
(
done
)
->
client
.
on
events
.
broadcast
.
distributions
,
(
data
)
->
client
.
on
ce
events
.
broadcast
.
distributions
,
(
data
)
->
data
.
should
.
be
.
eql
([
'trusty'
,
'unstable'
])
data
.
should
.
be
.
eql
([
'trusty'
,
'unstable'
])
done
()
done
()
it
'get debomatic status'
,
(
done
)
->
it
'get debomatic status'
,
(
done
)
->
client
.
on
events
.
broadcast
.
status_debomatic
,
(
data
)
->
client
.
on
ce
events
.
broadcast
.
status_debomatic
,
(
data
)
->
data
.
running
.
should
.
be
.
false
data
.
running
.
should
.
be
.
false
done
()
done
()
it
'get package status'
,
(
done
)
->
it
'get package status'
,
(
done
)
->
client
.
on
events
.
broadcast
.
status
,
(
data
)
->
client
.
once
events
.
client
.
status
,
(
data
)
->
data
=
data
[
0
]
data
.
status
.
should
.
be
.
eql
(
'build'
)
data
.
status
.
should
.
be
.
eql
(
'build'
)
data
.
distribution
.
should
.
be
.
eql
(
'unstable'
)
data
.
distribution
.
should
.
be
.
eql
(
'unstable'
)
data
.
package
.
should
.
be
.
eql
(
'test_1.2.3'
)
data
.
package
.
should
.
be
.
eql
(
'test_1.2.3'
)
done
()
done
()
it
'on getting distribution packages'
,
->
it
'on getting distribution packages'
,
(
done
)
->
helper
.
make_package
(
'unstable'
,
'test_1.2.3'
)
helper
.
make_package
(
'unstable'
,
'test_1.2.3'
)
helper
.
make_package
(
'unstable'
,
'test_1.2.4'
)
helper
.
make_package
(
'unstable'
,
'test_1.2.4'
)
client
.
emit
(
events
.
client
.
distribution_packages
,
helper
.
get_query
(
'unstable'
))
client
.
emit
(
events
.
client
.
distribution_packages
,
helper
.
get_query
(
'unstable'
))
client
.
on
events
.
client
.
distribution_packages
,
(
data
)
->
client
.
on
ce
events
.
client
.
distribution_packages
,
(
data
)
->
data
.
distribution
.
name
.
should
.
be
.
eql
(
'unstable'
)
data
.
distribution
.
name
.
should
.
be
.
eql
(
'unstable'
)
packages_name
=
[]
packages_name
=
[]
for
p
in
data
.
distribution
.
packages
for
p
in
data
.
distribution
.
packages
packages_name
.
push
(
p
.
orig_name
)
packages_name
.
push
(
p
.
orig_name
)
packages_name
.
should
.
be
.
eql
([
'test_1.2.3'
,
'test_1.2.4'
])
packages_name
.
should
.
be
.
eql
([
'test_1.2.3'
,
'test_1.2.4'
])
done
()
it
'on getting package list'
,
->
it
'on getting package list'
,
(
done
)
->
helper
.
make_file
(
'unstable'
,
'test_1.2.3'
,
'buildlog'
,
'test'
)
helper
.
make_file
(
'unstable'
,
'test_1.2.3'
,
'buildlog'
,
'test'
)
helper
.
make_file
(
'unstable'
,
'test_1.2.3'
,
'lintian'
,
'test'
)
helper
.
make_file
(
'unstable'
,
'test_1.2.3'
,
'lintian'
,
'test'
)
client
.
emit
(
events
.
client
.
package_files_list
,
helper
.
get_query
(
'unstable'
,
'test_1.2.3'
))
client
.
emit
(
events
.
client
.
package_files_list
,
helper
.
get_query
(
'unstable'
,
'test_1.2.3'
))
client
.
on
events
.
client
.
package_files_list
,
(
data
)
->
client
.
on
ce
events
.
client
.
package_files_list
,
(
data
)
->
data
.
distribution
.
name
.
should
.
be
.
eql
(
'unstable'
)
data
.
distribution
.
name
.
should
.
be
.
eql
(
'unstable'
)
data
.
package
.
orig_name
.
should
.
be
.
eql
(
'test_1.2.3'
)
data
.
package
.
orig_name
.
should
.
be
.
eql
(
'test_1.2.3'
)
files_name
=
[]
files_name
=
[]
for
f
in
data
.
package
.
files
for
f
in
data
.
package
.
files
files_name
.
push
(
f
.
name
)
files_name
.
push
(
f
.
name
)
files_name
.
should
.
be
.
eql
([
'buildlog'
,
'lintian'
])
files_name
.
should
.
be
.
eql
([
'buildlog'
,
'lintian'
])
done
()
describe
'on getting file'
,
->
describe
'on getting file'
,
->
it
'full content'
,
->
it
'full content'
,
(
done
)
->
helper
.
make_file
(
'unstable'
,
'test_1.2.3'
,
'buildlog'
,
'this is a test'
)
helper
.
make_file
(
'unstable'
,
'test_1.2.3'
,
'buildlog'
,
'this is a test'
)
client
.
emit
(
events
.
client
.
file
,
helper
.
get_query
(
'unstable'
,
'test_1.2.3'
,
'buildlog'
))
client
.
emit
(
events
.
client
.
file
,
helper
.
get_query
(
'unstable'
,
'test_1.2.3'
,
'buildlog'
))
client
.
on
events
.
client
.
file
,
(
data
)
->
client
.
on
ce
events
.
client
.
file
,
(
data
)
->
data
.
distribution
.
name
.
should
.
be
.
eql
(
'unstable'
)
data
.
distribution
.
name
.
should
.
be
.
eql
(
'unstable'
)
data
.
package
.
orig_name
.
should
.
be
.
eql
(
'test_1.2.3'
)
data
.
package
.
orig_name
.
should
.
be
.
eql
(
'test_1.2.3'
)
data
.
file
.
name
.
should
.
be
.
eql
(
'buildlog'
)
data
.
file
.
name
.
should
.
be
.
eql
(
'buildlog'
)
data
.
file
.
content
.
should
.
be
.
eql
(
'this is a test
\n
'
)
data
.
file
.
content
.
should
.
be
.
eql
(
'this is a test
\n
'
)
done
()
it
'new content'
,
(
done
)
->
it
'new content'
,
(
done
)
->
client
.
on
events
.
client
.
file_newcontent
,
(
data
)
->
client
.
on
ce
events
.
client
.
file_newcontent
,
(
data
)
->
data
.
distribution
.
name
.
should
.
be
.
eql
(
'unstable'
)
data
.
distribution
.
name
.
should
.
be
.
eql
(
'unstable'
)
data
.
package
.
orig_name
.
should
.
be
.
eql
(
'test_1.2.3'
)
data
.
package
.
orig_name
.
should
.
be
.
eql
(
'test_1.2.3'
)
data
.
file
.
name
.
should
.
be
.
eql
(
'buildlog'
)
data
.
file
.
name
.
should
.
be
.
eql
(
'buildlog'
)
data
.
file
.
new_content
.
should
.
be
.
eql
(
'this is an appending test
\n
'
)
data
.
file
.
new_content
.
should
.
be
.
eql
(
'this is an appending test
\n
'
)
done
()
client
.
emit
(
events
.
client
.
file
,
helper
.
get_query
(
'unstable'
,
'test_1.2.3'
,
'buildlog'
))
helper
.
append_file
(
'unstable'
,
'test_1.2.3'
,
'buildlog'
,
'this is an appending test'
)
helper
.
append_file
(
'unstable'
,
'test_1.2.3'
,
'buildlog'
,
'this is an appending test'
)
describe
'on build package ends'
,
->
describe
'on build package ends'
,
->
it
'should receive a status update'
,
(
done
)
->
it
'should receive a status update'
,
(
done
)
->
str
=
'{"status": "build", "success": true, "package": "test_1.2.3", "uploader": "", "distribution": "unstable"}'
str
=
'{"status": "build", "success": true, "package": "test_1.2.3", "uploader": "", "distribution": "unstable"}'
helper
.
append_json
(
str
)
helper
.
append_json
(
str
)
client
.
on
events
.
broadcast
.
status_update
,
(
data
)
->
client
.
on
ce
events
.
broadcast
.
status_update
,
(
data
)
->
data
.
success
.
should
.
not
.
be
.
ok
data
.
success
.
should
.
be
.
ok
done
()
done
()
process
.
on
'exit'
,
()
->
process
.
on
'exit'
,
()
->
client
.
disconnect
()
client
.
disconnect
()
helper
.
clean_all
()
#helper.clean_all()# if process.env.SERVER
server
.
kill
()
if
process
.
env
.
SERVER
server
.
kill
()
if
process
.
env
.
SERVER
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment