Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
c39e688c
"...composable_kernel_rocm.git" did not exist on "56c7203541460a3787a795fabede9ec294fcdbcd"
Unverified
Commit
c39e688c
authored
Dec 21, 2018
by
chicm-ms
Committed by
GitHub
Dec 21, 2018
Browse files
Fix IPC unit test (#511)
* Fix IPC unit test * updates
parent
26cef96c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
src/nni_manager/common/errors.ts
src/nni_manager/common/errors.ts
+2
-0
src/nni_manager/core/ipcInterface.ts
src/nni_manager/core/ipcInterface.ts
+1
-1
src/nni_manager/core/test/ipcInterface.test.ts
src/nni_manager/core/test/ipcInterface.test.ts
+8
-2
No files found.
src/nni_manager/common/errors.ts
View file @
c39e688c
...
...
@@ -26,12 +26,14 @@ export namespace NNIErrorNames {
}
export
class
NNIError
extends
Error
{
public
cause
!
:
Error
|
undefined
;
constructor
(
name
:
string
,
message
:
string
,
err
?:
Error
)
{
super
(
message
);
this
.
name
=
name
;
if
(
err
!==
undefined
)
{
this
.
stack
=
err
.
stack
;
}
this
.
cause
=
err
;
}
}
...
...
src/nni_manager/core/ipcInterface.ts
View file @
c39e688c
...
...
@@ -103,7 +103,7 @@ class IpcInterface {
try
{
const
data
:
Buffer
=
encodeCommand
(
commandType
,
content
);
if
(
!
this
.
outgoingStream
.
write
(
data
))
{
this
.
logger
.
error
(
'
Commands jammed in buffer!
'
);
this
.
logger
.
warning
(
'
Commands jammed in buffer!
'
);
}
}
catch
(
err
)
{
throw
new
NNIError
(
'
Dispatcher Error
'
,
`Dispatcher Error:
${
err
.
message
}
`
,
err
);
...
...
src/nni_manager/core/test/ipcInterface.test.ts
View file @
c39e688c
...
...
@@ -25,6 +25,7 @@ import { Deferred } from 'ts-deferred';
import
{
cleanupUnitTest
,
prepareUnitTest
}
from
'
../../common/utils
'
;
import
*
as
CommandType
from
'
../commands
'
;
import
{
createDispatcherInterface
,
IpcInterface
}
from
'
../ipcInterface
'
;
import
{
NNIError
}
from
'
../../common/errors
'
;
let
sentCommands
:
{[
key
:
string
]:
string
}[]
=
[];
const
receivedCommands
:
{[
key
:
string
]:
string
}[]
=
[];
...
...
@@ -105,8 +106,13 @@ describe('core/protocol', (): void => {
});
it
(
'
sendCommand() should throw on too long command
'
,
():
void
=>
{
assert
.
equal
((
<
Error
>
commandTooLong
).
name
,
'
RangeError
'
);
assert
.
equal
((
<
Error
>
commandTooLong
).
message
,
'
Command too long
'
);
if
(
commandTooLong
===
undefined
)
{
assert
.
fail
(
'
Should throw error
'
)
}
else
{
const
err
:
Error
|
undefined
=
(
<
NNIError
>
commandTooLong
).
cause
;
assert
(
err
&&
err
.
name
===
'
RangeError
'
);
assert
(
err
&&
err
.
message
===
'
Command too long
'
);
}
});
it
(
'
sendCommand() should throw on wrong command type
'
,
():
void
=>
{
...
...
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