Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core-data):To improve core-data fuzzing test coverage with swagger… #4690

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# SPDX-License-Identifier: Apache-2.0
#

.PHONY: build clean unittest hadolint lint test docker run sbom docker-fuzz fuzz-test-command
.PHONY: build clean unittest hadolint lint test docker run sbom docker-fuzz fuzz-test-command fuzz-test-data

# change the following boolean flag to include or exclude the delayed start libs for builds for most of core services except support services
INCLUDE_DELAYED_START_BUILD_CORE:="false"
Expand Down Expand Up @@ -373,4 +373,8 @@ docker-fuzz:

fuzz-test-command:
# not joining the edgex-network due to swagger file url pointing to localhost for fuzz testing in the container
docker run --net host --rm -v "$$PWD/fuzz_test/fuzz_results:/fuzz_results" fuzz-edgex-go:latest core-command /restler-fuzzer/openapi/core-command.yaml
docker run --net host --rm -v "$$PWD/fuzz_test/fuzz_results:/fuzz_results" fuzz-edgex-go:latest core-command /restler-fuzzer/openapi/core-command.yaml

fuzz-test-data:
# not joining the edgex-network due to swagger file url pointing to localhost for fuzz testing in the container
docker run --net host --rm -v "$$PWD/fuzz_test/fuzz_results:/fuzz_results" fuzz-edgex-go:latest core-data /restler-fuzzer/openapi/core-data.yaml
75 changes: 41 additions & 34 deletions openapi/v3/core-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,17 @@ components:
oneOf:
- $ref: '#/components/schemas/SimpleReading'
- $ref: '#/components/schemas/BinaryReading'
- $ref: '#/components/schemas/ObjectReading'
- $ref: '#/components/schemas/ObjectReading'
example: [
{
"deviceName": "Random-Boolean-Device",
"profileName": "Random-Boolean-Device",
"resourceName": "Bool",
"origin": 1692721935934211905,
"valueType": "Bool",
"value": "false"
}
]
tags:
description: "List of zero or more Tags attached to the Event which give more context to the Event"
title: tags
Expand Down Expand Up @@ -492,45 +502,42 @@ components:
statusCode: 200
totalCount: 5
readings:
- deviceName: "device-001"
resourceName: "resource-001"
profileName: "profile-001"
- deviceName: "Random-Boolean-Device"
resourceName: "Bool"
profileName: "Random-Boolean-Device"
id: "31569347-9369-43ec-aa6a-59ea9c624a6f"
origin: 1602168089665565300
valueType: "Float32"
value: "39.5"
- deviceName: "device-001"
resourceName: "resource-001"
profileName: "profile-001"
valueType: "Bool"
value: "false"
- deviceName: "Random-Integer-Device"
resourceName: "Int8"
profileName: "Random-Integer-Device"
id: "2fd73a5b-969f-483c-9c52-6bb460a06eb1"
origin: 1602168089665565300
valueType: "Int8"
value: "75"
- deviceName: "device-002"
- deviceName: "Random-Binary-Device"
resourceName: "resource-002"
profileName: "profile-002"
profileName: "Random-Binary-Device"
id: "71c601d9-cb56-453a-8c75-54461e444713"
origin: 1602168089665565300
valueType: "Binary"
binaryValue: [12,34]
mediaType: "image"
- deviceName: "device-002"
resourceName: "resource-002"
profileName: "profile-002"
- deviceName: "Random-Float-Device"
resourceName: "Float32"
profileName: "Random-Float-Device"
id: "7003cacc-0e00-4676-977c-4e58b9612abd"
origin: 1602168089665565300
valueType: "Float32"
value: "12.2"
- deviceName: "device-002"
resourceName: "resource-003"
profileName: "profile-002"
- deviceName: "Random-UnsignedInteger-Device"
resourceName: "Uint8"
profileName: "Random-UnsignedInteger-Device"
id: "71c601d9-cb56-453a-8c75-54461e444715"
origin: 1602168089665565300
valueType: "Object"
objectValue:
Attr1: "yyz"
Attr2: -45
Attr3: [255, 1, 0]
valueType: "Uint8"
value: "77"
ReadingsByResourceNameAndTimeRangeExample:
value:
apiVersion: "v3"
Expand Down Expand Up @@ -596,11 +603,11 @@ paths:
apiVersion: v3
event:
apiVersion: v3
deviceName: device-002
profileName: profile-002
sourceName: resource-002
id: d5471d59-2810-419a-8744-18eb8fa03465
origin: 1602168089665565300
deviceName: Random-Boolean-Device
profileName: Random-Boolean-Device
sourceName: Bool
id: 563513b3-f020-46fa-ae44-0fdd1d129185
origin: 1692721935934211905
tags:
Gateway: "HoustonStore-000123"
Latitude:
Expand All @@ -612,13 +619,13 @@ paths:
minute: 31.0
second: 19.600799999980154
readings:
- deviceName: device-002
resourceName: resource-002
profileName: profile-002
id: 7003cacc-0e00-4676-977c-4e58b9612abd
origin: 1602168089665565300
valueType: Float32
value: '12.2'
- deviceName: Random-Boolean-Device
resourceName: Bool
profileName: Random-Boolean-Device
id: 563513b3-f020-46fa-ae44-0fdd1d129185
origin: 1692721935934211905
valueType: Bool
value: 'false'
responses:
'201':
description: "Indicates the event has been successfully added."
Expand Down