Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Mizu
Commits
4ca20800
Commit
4ca20800
authored
3 years ago
by
Liraz Yehezkel
Browse files
Options
Download
Plain Diff
no message
parents
dde65984
785e8b77
Changes
50
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
acceptanceTests/cypress/e2e/tests/UiTest.js
+15
-46
acceptanceTests/cypress/e2e/tests/UiTest.js
acceptanceTests/extensions_test.go
+3
-0
acceptanceTests/extensions_test.go
agent/main.go
+4
-4
agent/main.go
agent/pkg/controllers/oas_controller_test.go
+3
-3
agent/pkg/controllers/oas_controller_test.go
agent/pkg/oas/ignores.go
+1
-1
agent/pkg/oas/ignores.go
agent/pkg/oas/oas_generator.go
+10
-7
agent/pkg/oas/oas_generator.go
agent/pkg/oas/oas_generator_test.go
+1
-1
agent/pkg/oas/oas_generator_test.go
agent/pkg/oas/specgen.go
+17
-11
agent/pkg/oas/specgen.go
agent/pkg/oas/specgen_test.go
+4
-4
agent/pkg/oas/specgen_test.go
agent/pkg/oas/test_artifacts/params.har.spec.json
+1
-1
agent/pkg/oas/test_artifacts/params.har.spec.json
cli/cmd/installRunner.go
+1
-1
cli/cmd/installRunner.go
cli/config/configStruct.go
+1
-1
cli/config/configStruct.go
shared/models.go
+6
-1
shared/models.go
ui-common/package-lock.json
+2469
-3186
ui-common/package-lock.json
ui-common/package.json
+1
-1
ui-common/package.json
ui-common/src/components/EntriesList/EntriesList.tsx
+2
-2
ui-common/src/components/EntriesList/EntriesList.tsx
ui-common/src/components/EntriesList/assets/downImg.svg
+0
-0
ui-common/src/components/EntriesList/assets/downImg.svg
ui-common/src/components/EntriesList/assets/spinner.svg
+0
-0
ui-common/src/components/EntriesList/assets/spinner.svg
ui-common/src/components/EntryDetailed/EntryDetailed.tsx
+1
-1
ui-common/src/components/EntryDetailed/EntryDetailed.tsx
ui-common/src/components/EntryDetailed/EntrySections/EntrySections.tsx
+3
-3
.../components/EntryDetailed/EntrySections/EntrySections.tsx
with
2543 additions
and
3274 deletions
+2543
-3274
acceptanceTests/cypress/e2e/tests/UiTest.js
+
15
-
46
View file @
4ca20800
...
...
@@ -269,7 +269,7 @@ function checkRightSideResponseBody() {
const
responseBody
=
JSON
.
parse
(
decodedBody
);
const
expectdJsonBody
=
{
const
expect
e
dJsonBody
=
{
args
:
RegExp
({}),
url
:
RegExp
(
'
http://.*/get
'
),
headers
:
{
...
...
@@ -279,27 +279,24 @@ function checkRightSideResponseBody() {
}
};
expect
(
responseBody
.
args
).
to
.
match
(
expectdJsonBody
.
args
);
expect
(
responseBody
.
url
).
to
.
match
(
expectdJsonBody
.
url
);
expect
(
responseBody
.
headers
[
'
User-Agent
'
]).
to
.
match
(
expectdJsonBody
.
headers
[
'
User-Agent
'
]);
expect
(
responseBody
.
headers
[
'
Accept-Encoding
'
]).
to
.
match
(
expectdJsonBody
.
headers
[
'
Accept-Encoding
'
]);
expect
(
responseBody
.
headers
[
'
X-Forwarded-Uri
'
]).
to
.
match
(
expectdJsonBody
.
headers
[
'
X-Forwarded-Uri
'
]);
const
expectedStringInJsonBody
=
RegExp
(
'
/api/v1/namespaces/.*/services/.*/proxy/get
'
);
expect
(
responseBody
.
args
).
to
.
match
(
expectedJsonBody
.
args
);
expect
(
responseBody
.
url
).
to
.
match
(
expectedJsonBody
.
url
);
expect
(
responseBody
.
headers
[
'
User-Agent
'
]).
to
.
match
(
expectedJsonBody
.
headers
[
'
User-Agent
'
]);
expect
(
responseBody
.
headers
[
'
Accept-Encoding
'
]).
to
.
match
(
expectedJsonBody
.
headers
[
'
Accept-Encoding
'
]);
expect
(
responseBody
.
headers
[
'
X-Forwarded-Uri
'
]).
to
.
match
(
expectedJsonBody
.
headers
[
'
X-Forwarded-Uri
'
]);
cy
.
get
(
`
${
Cypress
.
env
(
'
bodyJsonClass
'
)}
`
).
should
(
'
have.text
'
,
encodedBody
);
cy
.
get
(
`[data-cy="lineNumbersCheckBoxInput"]`
).
should
(
'
be.disabled
'
);
clickCheckbox
(
'
Decode Base64
'
);
cy
.
get
(
`[data-cy="lineNumbersCheckBoxInput"]`
).
should
(
'
not.be.disabled
'
);
cy
.
get
(
`
${
Cypress
.
env
(
'
bodyJsonClass
'
)}
> `
).
its
(
'
length
'
).
should
(
'
be.gt
'
,
1
).
then
(
linesNum
=>
{
cy
.
get
(
`
${
Cypress
.
env
(
'
bodyJsonClass
'
)}
> >`
).
its
(
'
length
'
).
should
(
'
be.gt
'
,
linesNum
).
then
(
jsonItemsNum
=>
{
// checkPrettyAndLineNums(decodedBody);
//clickCheckbox('Line numbers');
//checkPrettyOrNothing(jsonItemsNum, decodedBody);
// clickCheckbox('Pretty');
// checkPrettyOrNothing(jsonItemsNum, decodedBody);
//
// clickCheckbox('Line numbers');
// checkOnlyLineNumberes(jsonItemsNum, decodedBody);
checkOnlyLineNumberes
(
jsonItemsNum
,
expectedStringInJsonBody
);
});
});
});
...
...
@@ -309,37 +306,9 @@ function clickCheckbox(type) {
cy
.
contains
(
`
${
type
}
`
).
prev
().
children
().
click
();
}
function
checkPrettyAndLineNums
(
decodedBody
)
{
decodedBody
=
decodedBody
.
replaceAll
(
'
'
,
''
);
cy
.
get
(
`
${
Cypress
.
env
(
'
bodyJsonClass
'
)}
>`
).
then
(
elements
=>
{
const
lines
=
Object
.
values
(
elements
);
lines
.
forEach
((
line
,
index
)
=>
{
if
(
line
.
getAttribute
)
{
const
cleanLine
=
getCleanLine
(
line
);
const
currentLineFromDecodedText
=
decodedBody
.
substring
(
0
,
cleanLine
.
length
);
expect
(
cleanLine
).
to
.
equal
(
currentLineFromDecodedText
,
`expected the text in line number
${
index
+
1
}
to match the text that generated by the base64 decoding`
)
decodedBody
=
decodedBody
.
substring
(
cleanLine
.
length
);
}
});
});
}
function
getCleanLine
(
lineElement
)
{
return
(
lineElement
.
innerText
.
substring
(
0
,
lineElement
.
innerText
.
length
-
1
)).
replaceAll
(
'
'
,
''
);
}
function
checkPrettyOrNothing
(
jsonItems
,
decodedBody
)
{
cy
.
get
(
`
${
Cypress
.
env
(
'
bodyJsonClass
'
)}
> `
).
should
(
'
have.length
'
,
jsonItems
).
then
(
text
=>
{
const
json
=
text
.
text
();
expect
(
json
).
to
.
equal
(
decodedBody
);
});
}
function
checkOnlyLineNumberes
(
jsonItems
,
decodedText
)
{
cy
.
get
(
`
${
Cypress
.
env
(
'
bodyJsonClass
'
)}
>`
).
should
(
'
have.length
'
,
1
).
and
(
'
have.text
'
,
decodedText
);
cy
.
get
(
`
${
Cypress
.
env
(
'
bodyJsonClass
'
)}
>
>`
).
should
(
'
have.length
'
,
jsonItems
)
cy
.
get
(
`
${
Cypress
.
env
(
'
bodyJsonClass
'
)}
>
>`
).
should
(
'
have.length
'
,
jsonItems
);
cy
.
get
(
`
${
Cypress
.
env
(
'
bodyJsonClass
'
)}
>`
).
contains
(
decodedText
);
}
function
serviceMapCheck
()
{
...
...
This diff is collapsed.
Click to expand it.
acceptanceTests/extensions_test.go
+
3
-
0
View file @
4ca20800
...
...
@@ -109,6 +109,9 @@ func TestRedis(t *testing.T) {
}
func
TestAmqp
(
t
*
testing
.
T
)
{
t
.
Skip
(
"ignoredd for now because those tests are not stable"
)
if
testing
.
Short
()
{
t
.
Skip
(
"ignored acceptance test"
)
}
...
...
This diff is collapsed.
Click to expand it.
agent/main.go
+
4
-
4
View file @
4ca20800
...
...
@@ -118,7 +118,7 @@ func hostApi(socketHarOutputChannel chan<- *tapApi.OutputChannelItem) *gin.Engin
api
.
WebSocketRoutes
(
ginApp
,
&
eventHandlers
)
if
config
.
Config
.
OAS
{
if
config
.
Config
.
OAS
.
Enable
{
routes
.
OASRoutes
(
ginApp
)
}
...
...
@@ -200,7 +200,7 @@ func runInHarReaderMode() {
}
func
enableExpFeatureIfNeeded
()
{
if
config
.
Config
.
OAS
{
if
config
.
Config
.
OAS
.
Enable
{
oasGenerator
:=
dependency
.
GetInstance
(
dependency
.
OasGeneratorDependency
)
.
(
oas
.
OasGenerator
)
oasGenerator
.
Start
()
}
...
...
@@ -227,7 +227,7 @@ func setUIFlags(uiIndexPath string) error {
return
err
}
replacedContent
:=
strings
.
Replace
(
string
(
read
),
"__IS_OAS_ENABLED__"
,
strconv
.
FormatBool
(
config
.
Config
.
OAS
),
1
)
replacedContent
:=
strings
.
Replace
(
string
(
read
),
"__IS_OAS_ENABLED__"
,
strconv
.
FormatBool
(
config
.
Config
.
OAS
.
Enable
),
1
)
replacedContent
=
strings
.
Replace
(
replacedContent
,
"__IS_SERVICE_MAP_ENABLED__"
,
strconv
.
FormatBool
(
config
.
Config
.
ServiceMap
),
1
)
err
=
ioutil
.
WriteFile
(
uiIndexPath
,
[]
byte
(
replacedContent
),
0
)
...
...
@@ -363,7 +363,7 @@ func handleIncomingMessageAsTapper(socketConnection *websocket.Conn) {
func
initializeDependencies
()
{
dependency
.
RegisterGenerator
(
dependency
.
ServiceMapGeneratorDependency
,
func
()
interface
{}
{
return
servicemap
.
GetDefaultServiceMapInstance
()
})
dependency
.
RegisterGenerator
(
dependency
.
OasGeneratorDependency
,
func
()
interface
{}
{
return
oas
.
GetDefaultOasGeneratorInstance
()
})
dependency
.
RegisterGenerator
(
dependency
.
OasGeneratorDependency
,
func
()
interface
{}
{
return
oas
.
GetDefaultOasGeneratorInstance
(
config
.
Config
.
OAS
.
MaxExampleLen
)
})
dependency
.
RegisterGenerator
(
dependency
.
EntriesInserter
,
func
()
interface
{}
{
return
api
.
GetBasenineEntryInserterInstance
()
})
dependency
.
RegisterGenerator
(
dependency
.
EntriesProvider
,
func
()
interface
{}
{
return
&
entries
.
BasenineEntriesProvider
{}
})
dependency
.
RegisterGenerator
(
dependency
.
EntriesSocketStreamer
,
func
()
interface
{}
{
return
&
api
.
BasenineEntryStreamer
{}
})
...
...
This diff is collapsed.
Click to expand it.
agent/pkg/controllers/oas_controller_test.go
+
3
-
3
View file @
4ca20800
...
...
@@ -34,12 +34,12 @@ func TestGetOASSpec(t *testing.T) {
func
getRecorderAndContext
()
(
*
httptest
.
ResponseRecorder
,
*
gin
.
Context
)
{
dependency
.
RegisterGenerator
(
dependency
.
OasGeneratorDependency
,
func
()
interface
{}
{
return
oas
.
GetDefaultOasGeneratorInstance
()
return
oas
.
GetDefaultOasGeneratorInstance
(
-
1
)
})
recorder
:=
httptest
.
NewRecorder
()
c
,
_
:=
gin
.
CreateTestContext
(
recorder
)
oas
.
GetDefaultOasGeneratorInstance
()
.
Start
()
oas
.
GetDefaultOasGeneratorInstance
()
.
GetServiceSpecs
()
.
Store
(
"some"
,
oas
.
NewGen
(
"some"
))
oas
.
GetDefaultOasGeneratorInstance
(
-
1
)
.
Start
()
oas
.
GetDefaultOasGeneratorInstance
(
-
1
)
.
GetServiceSpecs
()
.
Store
(
"some"
,
oas
.
NewGen
(
"some"
))
return
recorder
,
c
}
This diff is collapsed.
Click to expand it.
agent/pkg/oas/ignores.go
+
1
-
1
View file @
4ca20800
...
...
@@ -9,7 +9,7 @@ var ignoredCtypes = []string{"application/javascript", "application/x-javascript
var
ignoredHeaders
=
[]
string
{
"a-im"
,
"accept"
,
"authorization"
,
"cache-control"
,
"connection"
,
"content-encoding"
,
"content-length"
,
"content-type"
,
"cookie"
,
"authorization"
,
"cache-control"
,
"connection"
,
"content-encoding"
,
"content-length"
,
"content-range"
,
"content-type"
,
"cookie"
,
"date"
,
"dnt"
,
"expect"
,
"forwarded"
,
"from"
,
"front-end-https"
,
"host"
,
"http2-settings"
,
"max-forwards"
,
"origin"
,
"pragma"
,
"proxy-authorization"
,
"proxy-connection"
,
"range"
,
"referer"
,
"save-data"
,
"te"
,
"trailer"
,
"transfer-encoding"
,
"upgrade"
,
"upgrade-insecure-requests"
,
"x-download-options"
,
...
...
This diff is collapsed.
Click to expand it.
agent/pkg/oas/oas_generator.go
+
10
-
7
View file @
4ca20800
...
...
@@ -28,13 +28,14 @@ type OasGenerator interface {
}
type
defaultOasGenerator
struct
{
started
bool
serviceSpecs
*
sync
.
Map
started
bool
serviceSpecs
*
sync
.
Map
maxExampleLen
int
}
func
GetDefaultOasGeneratorInstance
()
*
defaultOasGenerator
{
func
GetDefaultOasGeneratorInstance
(
maxExampleLen
int
)
*
defaultOasGenerator
{
syncOnce
.
Do
(
func
()
{
instance
=
NewDefaultOasGenerator
()
instance
=
NewDefaultOasGenerator
(
maxExampleLen
)
logger
.
Log
.
Debug
(
"OAS Generator Initialized"
)
})
return
instance
...
...
@@ -117,6 +118,7 @@ func (g *defaultOasGenerator) getGen(dest string, urlStr string) *SpecGen {
var
gen
*
SpecGen
if
!
found
{
gen
=
NewGen
(
u
.
Scheme
+
"://"
+
dest
)
gen
.
MaxExampleLen
=
g
.
maxExampleLen
g
.
serviceSpecs
.
Store
(
dest
,
gen
)
}
else
{
gen
=
val
.
(
*
SpecGen
)
...
...
@@ -132,9 +134,10 @@ func (g *defaultOasGenerator) GetServiceSpecs() *sync.Map {
return
g
.
serviceSpecs
}
func
NewDefaultOasGenerator
()
*
defaultOasGenerator
{
func
NewDefaultOasGenerator
(
maxExampleLen
int
)
*
defaultOasGenerator
{
return
&
defaultOasGenerator
{
started
:
false
,
serviceSpecs
:
&
sync
.
Map
{},
started
:
false
,
serviceSpecs
:
&
sync
.
Map
{},
maxExampleLen
:
maxExampleLen
,
}
}
This diff is collapsed.
Click to expand it.
agent/pkg/oas/oas_generator_test.go
+
1
-
1
View file @
4ca20800
...
...
@@ -8,7 +8,7 @@ import (
)
func
TestOASGen
(
t
*
testing
.
T
)
{
gen
:=
GetDefaultOasGeneratorInstance
()
gen
:=
GetDefaultOasGeneratorInstance
(
-
1
)
e
:=
new
(
har
.
Entry
)
err
:=
json
.
Unmarshal
([]
byte
(
`{"startedDateTime": "20000101","request": {"url": "https://host/path", "method": "GET"}, "response": {"status": 200}}`
),
e
)
...
...
This diff is collapsed.
Click to expand it.
agent/pkg/oas/specgen.go
+
17
-
11
View file @
4ca20800
...
...
@@ -42,6 +42,8 @@ type reqResp struct { // hello, generics in Go
}
type
SpecGen
struct
{
MaxExampleLen
int
// -1 unlimited, 0 and above sets limit
oas
*
openapi
.
OpenAPI
tree
*
Node
lock
sync
.
Mutex
...
...
@@ -59,7 +61,11 @@ func NewGen(server string) *SpecGen {
spec
.
Servers
=
make
([]
*
openapi
.
Server
,
0
)
spec
.
Servers
=
append
(
spec
.
Servers
,
&
openapi
.
Server
{
URL
:
server
})
gen
:=
SpecGen
{
oas
:
spec
,
tree
:
new
(
Node
)}
gen
:=
SpecGen
{
oas
:
spec
,
tree
:
new
(
Node
),
MaxExampleLen
:
-
1
,
}
return
&
gen
}
...
...
@@ -228,7 +234,7 @@ func (g *SpecGen) handlePathObj(entryWithSource *EntryWithSource) (string, error
split
=
strings
.
Split
(
urlParsed
.
Path
,
"/"
)
}
node
:=
g
.
tree
.
getOrSet
(
split
,
new
(
openapi
.
PathObj
),
entryWithSource
.
Id
)
opObj
,
err
:=
handleOpObj
(
entryWithSource
,
node
.
pathObj
)
opObj
,
err
:=
handleOpObj
(
entryWithSource
,
node
.
pathObj
,
g
.
MaxExampleLen
)
if
opObj
!=
nil
{
return
opObj
.
OperationID
,
err
...
...
@@ -237,7 +243,7 @@ func (g *SpecGen) handlePathObj(entryWithSource *EntryWithSource) (string, error
return
""
,
err
}
func
handleOpObj
(
entryWithSource
*
EntryWithSource
,
pathObj
*
openapi
.
PathObj
)
(
*
openapi
.
Operation
,
error
)
{
func
handleOpObj
(
entryWithSource
*
EntryWithSource
,
pathObj
*
openapi
.
PathObj
,
limit
int
)
(
*
openapi
.
Operation
,
error
)
{
entry
:=
entryWithSource
.
Entry
isSuccess
:=
100
<=
entry
.
Response
.
Status
&&
entry
.
Response
.
Status
<
400
opObj
,
wasMissing
,
err
:=
getOpObj
(
pathObj
,
entry
.
Request
.
Method
,
isSuccess
)
...
...
@@ -250,12 +256,12 @@ func handleOpObj(entryWithSource *EntryWithSource, pathObj *openapi.PathObj) (*o
return
nil
,
nil
}
err
=
handleRequest
(
&
entry
.
Request
,
opObj
,
isSuccess
,
entryWithSource
.
Id
)
err
=
handleRequest
(
&
entry
.
Request
,
opObj
,
isSuccess
,
entryWithSource
.
Id
,
limit
)
if
err
!=
nil
{
return
nil
,
err
}
err
=
handleResponse
(
&
entry
.
Response
,
opObj
,
isSuccess
,
entryWithSource
.
Id
)
err
=
handleResponse
(
&
entry
.
Response
,
opObj
,
isSuccess
,
entryWithSource
.
Id
,
limit
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -342,7 +348,7 @@ func handleCounters(opObj *openapi.Operation, success bool, entryWithSource *Ent
return
nil
}
func
handleRequest
(
req
*
har
.
Request
,
opObj
*
openapi
.
Operation
,
isSuccess
bool
,
sampleId
string
)
error
{
func
handleRequest
(
req
*
har
.
Request
,
opObj
*
openapi
.
Operation
,
isSuccess
bool
,
sampleId
string
,
limit
int
)
error
{
// TODO: we don't handle the situation when header/qstr param can be defined on pathObj level. Also the path param defined on opObj
urlParsed
,
err
:=
url
.
Parse
(
req
.
URL
)
if
err
!=
nil
{
...
...
@@ -390,7 +396,7 @@ func handleRequest(req *har.Request, opObj *openapi.Operation, isSuccess bool, s
}
else
{
reqCtype
,
_
:=
getReqCtype
(
req
)
reqMedia
,
err
:=
fillContent
(
reqResp
{
Req
:
req
},
reqBody
.
Content
,
reqCtype
,
sampleId
)
reqMedia
,
err
:=
fillContent
(
reqResp
{
Req
:
req
},
reqBody
.
Content
,
reqCtype
,
sampleId
,
limit
)
if
err
!=
nil
{
return
err
}
...
...
@@ -402,7 +408,7 @@ func handleRequest(req *har.Request, opObj *openapi.Operation, isSuccess bool, s
return
nil
}
func
handleResponse
(
resp
*
har
.
Response
,
opObj
*
openapi
.
Operation
,
isSuccess
bool
,
sampleId
string
)
error
{
func
handleResponse
(
resp
*
har
.
Response
,
opObj
*
openapi
.
Operation
,
isSuccess
bool
,
sampleId
string
,
limit
int
)
error
{
// TODO: we don't support "default" response
respObj
,
err
:=
getResponseObj
(
resp
,
opObj
,
isSuccess
)
if
err
!=
nil
{
...
...
@@ -415,7 +421,7 @@ func handleResponse(resp *har.Response, opObj *openapi.Operation, isSuccess bool
respCtype
:=
getRespCtype
(
resp
)
respContent
:=
respObj
.
Content
respMedia
,
err
:=
fillContent
(
reqResp
{
Resp
:
resp
},
respContent
,
respCtype
,
sampleId
)
respMedia
,
err
:=
fillContent
(
reqResp
{
Resp
:
resp
},
respContent
,
respCtype
,
sampleId
,
limit
)
if
err
!=
nil
{
return
err
}
...
...
@@ -467,7 +473,7 @@ func handleRespHeaders(reqHeaders []har.Header, respObj *openapi.ResponseObj, sa
}
}
func
fillContent
(
reqResp
reqResp
,
respContent
openapi
.
Content
,
ctype
string
,
sampleId
string
)
(
*
openapi
.
MediaType
,
error
)
{
func
fillContent
(
reqResp
reqResp
,
respContent
openapi
.
Content
,
ctype
string
,
sampleId
string
,
limit
int
)
(
*
openapi
.
MediaType
,
error
)
{
content
,
found
:=
respContent
[
ctype
]
if
!
found
{
respContent
[
ctype
]
=
&
openapi
.
MediaType
{}
...
...
@@ -510,7 +516,7 @@ func fillContent(reqResp reqResp, respContent openapi.Content, ctype string, sam
handleFormDataMultipart
(
text
,
content
,
params
)
}
if
content
.
Example
==
nil
&&
len
(
exampleMsg
)
>
len
(
content
.
Example
)
{
if
len
(
exampleMsg
)
>
len
(
content
.
Example
)
&&
(
limit
<
0
||
len
(
exampleMsg
)
<=
limit
)
{
content
.
Example
=
exampleMsg
}
}
...
...
This diff is collapsed.
Click to expand it.
agent/pkg/oas/specgen_test.go
+
4
-
4
View file @
4ca20800
...
...
@@ -48,7 +48,7 @@ func TestEntries(t *testing.T) {
t
.
FailNow
()
}
gen
:=
NewDefaultOasGenerator
()
gen
:=
NewDefaultOasGenerator
(
-
1
)
gen
.
serviceSpecs
=
new
(
sync
.
Map
)
loadStartingOAS
(
"test_artifacts/catalogue.json"
,
"catalogue"
,
gen
.
serviceSpecs
)
loadStartingOAS
(
"test_artifacts/trcc.json"
,
"trcc-api-service"
,
gen
.
serviceSpecs
)
...
...
@@ -122,7 +122,7 @@ func TestEntries(t *testing.T) {
}
func
TestFileSingle
(
t
*
testing
.
T
)
{
gen
:=
NewDefaultOasGenerator
()
gen
:=
NewDefaultOasGenerator
(
-
1
)
gen
.
serviceSpecs
=
new
(
sync
.
Map
)
// loadStartingOAS()
file
:=
"test_artifacts/params.har"
...
...
@@ -212,7 +212,7 @@ func loadStartingOAS(file string, label string, specs *sync.Map) {
}
func
TestEntriesNegative
(
t
*
testing
.
T
)
{
gen
:=
NewDefaultOasGenerator
()
gen
:=
NewDefaultOasGenerator
(
-
1
)
gen
.
serviceSpecs
=
new
(
sync
.
Map
)
files
:=
[]
string
{
"invalid"
}
_
,
err
:=
feedEntries
(
files
,
false
,
gen
)
...
...
@@ -223,7 +223,7 @@ func TestEntriesNegative(t *testing.T) {
}
func
TestEntriesPositive
(
t
*
testing
.
T
)
{
gen
:=
NewDefaultOasGenerator
()
gen
:=
NewDefaultOasGenerator
(
-
1
)
gen
.
serviceSpecs
=
new
(
sync
.
Map
)
files
:=
[]
string
{
"test_artifacts/params.har"
}
_
,
err
:=
feedEntries
(
files
,
false
,
gen
)
...
...
This diff is collapsed.
Click to expand it.
agent/pkg/oas/test_artifacts/params.har.spec.json
+
1
-
1
View file @
4ca20800
...
...
@@ -333,7 +333,7 @@
}
}
},
"example"
:
"agent-id=ade
\u
0026callback-url=
\u
0026token=sometoken"
,
"example"
:
"agent-id=ade
\u
0026callback-url=
\u
0026token=sometoken
-second-val
\u
0026optional=another
"
,
"x-sample-entry"
:
"000000000000000000000008"
}
},
...
...
This diff is collapsed.
Click to expand it.
cli/cmd/installRunner.go
+
1
-
1
View file @
4ca20800
...
...
@@ -25,7 +25,7 @@ func runMizuInstall() {
var
sb
strings
.
Builder
sb
.
WriteString
(
"Hello! This command can be used to install Mizu Pro edition on your Kubernetes cluster."
)
sb
.
WriteString
(
"
\n
Please run:"
)
sb
.
WriteString
(
"
\n\t
mizu install -o | kubectl apply -f -"
)
sb
.
WriteString
(
"
\n\t
mizu install -o | kubectl apply
-n mizu
-f -"
)
sb
.
WriteString
(
"
\n\n
or use helm chart as described in https://getmizu.io/docs/installing-mizu/centralized-installation
\n
"
)
fmt
.
Print
(
sb
.
String
())
...
...
This diff is collapsed.
Click to expand it.
cli/config/configStruct.go
+
1
-
1
View file @
4ca20800
...
...
@@ -39,7 +39,7 @@ type ConfigStruct struct {
HeadlessMode
bool
`yaml:"headless" default:"false"`
LogLevelStr
string
`yaml:"log-level,omitempty" default:"INFO" readonly:""`
ServiceMap
bool
`yaml:"service-map" default:"true"`
OAS
bool
`yaml:"oas"
default:"true"
`
OAS
shared
.
OASConfig
`yaml:"oas"`
}
func
(
config
*
ConfigStruct
)
validate
()
error
{
...
...
This diff is collapsed.
Click to expand it.
shared/models.go
+
6
-
1
View file @
4ca20800
...
...
@@ -32,6 +32,11 @@ type Resources struct {
MemoryRequests
string
`yaml:"memory-requests" default:"50Mi"`
}
type
OASConfig
struct
{
Enable
bool
`yaml:"enabled" default:"true"`
MaxExampleLen
int
`yaml:"max-example-len" default:"10240"`
}
type
MizuAgentConfig
struct
{
MaxDBSizeBytes
int64
`json:"maxDBSizeBytes"`
InsertionFilter
string
`json:"insertionFilter"`
...
...
@@ -42,7 +47,7 @@ type MizuAgentConfig struct {
MizuResourcesNamespace
string
`json:"mizuResourceNamespace"`
AgentDatabasePath
string
`json:"agentDatabasePath"`
ServiceMap
bool
`json:"serviceMap"`
OAS
bool
`json:"oas"`
OAS
OASConfig
`json:"oas"`
Telemetry
bool
`json:"telemetry"`
}
...
...
This diff is collapsed.
Click to expand it.
ui-common/package-lock.json
+
2469
-
3186
View file @
4ca20800
This diff is collapsed.
Click to expand it.
ui-common/package.json
+
1
-
1
View file @
4ca20800
...
...
@@ -26,7 +26,7 @@
"@craco/craco"
:
"^6.4.3"
,
"@types/jest"
:
"^26.0.24"
,
"@types/node"
:
"^12.20.54"
,
"
node-
sass"
:
"^
6.0.1
"
,
"sass"
:
"^
1.52.3
"
,
"react"
:
"^17.0.2"
,
"react-copy-to-clipboard"
:
"^5.1.0"
,
"react-dom"
:
"^17.0.2"
,
...
...
This diff is collapsed.
Click to expand it.
ui-common/src/components/EntriesList/EntriesList.tsx
+
2
-
2
View file @
4ca20800
...
...
@@ -3,8 +3,8 @@ import styles from './EntriesList.module.sass';
import
ScrollableFeedVirtualized
from
"
react-scrollable-feed-virtualized
"
;
import
Moment
from
'
moment
'
;
import
{
EntryItem
}
from
"
../EntryListItem/EntryListItem
"
;
import
down
from
"
../
assets/downImg.svg
"
;
import
spinner
from
'
../
assets/spinner.svg
'
;
import
down
from
"
assets/downImg.svg
"
;
import
spinner
from
'
assets/spinner.svg
'
;
import
{
RecoilState
,
useRecoilState
,
useRecoilValue
,
useSetRecoilState
}
from
"
recoil
"
;
import
entriesAtom
from
"
../../recoil/entries
"
;
import
queryAtom
from
"
../../recoil/query
"
;
...
...
This diff is collapsed.
Click to expand it.
ui-common/src/components/assets/downImg.svg
→
ui-common/src/components/
EntriesList/
assets/downImg.svg
+
0
-
0
View file @
4ca20800
File moved
This diff is collapsed.
Click to expand it.
ui-common/src/components/assets/spinner.svg
→
ui-common/src/components/
EntriesList/
assets/spinner.svg
+
0
-
0
View file @
4ca20800
File moved
This diff is collapsed.
Click to expand it.
ui-common/src/components/EntryDetailed/EntryDetailed.tsx
+
1
-
1
View file @
4ca20800
...
...
@@ -12,7 +12,7 @@ import TrafficViewerApiAtom from "../../recoil/TrafficViewerApi/atom";
import
queryAtom
from
"
../../recoil/query/atom
"
;
import
useWindowDimensions
,
{
useRequestTextByWidth
}
from
"
../../hooks/WindowDimensionsHook
"
;
import
{
TOAST_CONTAINER_ID
}
from
"
../../configs/Consts
"
;
import
spinner
from
"
../
assets/spinner.svg
"
;
import
spinner
from
"
assets/spinner.svg
"
;
const
useStyles
=
makeStyles
(()
=>
({
entryTitle
:
{
...
...
This diff is collapsed.
Click to expand it.
ui-common/src/components/EntryDetailed/EntrySections/EntrySections.tsx
+
3
-
3
View file @
4ca20800
...
...
@@ -192,17 +192,17 @@ export const EntryBodySection: React.FC<EntryBodySectionProps> = ({
>
<
div
style
=
{
{
display
:
'
flex
'
,
alignItems
:
'
center
'
,
alignContent
:
'
center
'
,
margin
:
"
5px 0
"
}
}
>
{
supportsPrettying
&&
<
div
style
=
{
{
paddingTop
:
3
}
}
>
<
Checkbox
checked
=
{
isPretty
}
onToggle
=
{
()
=>
{
setIsPretty
(
!
isPretty
)
}
}
/>
<
Checkbox
checked
=
{
isPretty
}
onToggle
=
{
()
=>
{
setIsPretty
(
!
isPretty
)
}
}
data-cy
=
"prettyCheckBoxInput"
/>
</
div
>
}
{
supportsPrettying
&&
<
span
style
=
{
{
marginLeft
:
'
.2rem
'
}
}
>
Pretty
</
span
>
}
<
div
style
=
{
{
paddingTop
:
3
,
paddingLeft
:
supportsPrettying
?
20
:
0
}
}
>
<
Checkbox
checked
=
{
showLineNumbers
}
onToggle
=
{
()
=>
{
setShowLineNumbers
(
!
showLineNumbers
)
}
}
disabled
=
{
!
isLineNumbersGreaterThenOne
||
!
decodeBase64
}
/>
<
Checkbox
checked
=
{
showLineNumbers
}
onToggle
=
{
()
=>
{
setShowLineNumbers
(
!
showLineNumbers
)
}
}
disabled
=
{
!
isLineNumbersGreaterThenOne
||
!
decodeBase64
}
data-cy
=
"lineNumbersCheckBoxInput"
/>
</
div
>
<
span
style
=
{
{
marginLeft
:
'
.2rem
'
}
}
>
Line numbers
</
span
>
{
isBase64Encoding
&&
<
div
style
=
{
{
paddingTop
:
3
,
paddingLeft
:
(
isLineNumbersGreaterThenOne
||
supportsPrettying
)
?
20
:
0
}
}
>
<
Checkbox
checked
=
{
decodeBase64
}
onToggle
=
{
()
=>
{
setDecodeBase64
(
!
decodeBase64
)
}
}
/>
<
Checkbox
checked
=
{
decodeBase64
}
onToggle
=
{
()
=>
{
setDecodeBase64
(
!
decodeBase64
)
}
}
data-cy
=
"decodeBase64CheckboxInput"
/>
</
div
>
}
{
isBase64Encoding
&&
<
span
style
=
{
{
marginLeft
:
'
.2rem
'
}
}
>
Decode Base64
</
span
>
}
{
!
isDecodeGrpc
&&
<
span
style
=
{
{
fontSize
:
'
12px
'
,
color
:
'
#DB2156
'
,
marginLeft
:
'
.8rem
'
}
}
>
More than one message in protobuf payload is not supported
</
span
>
}
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help