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

Add TimeInstant + explicitAttr tests (ftest 533) #1610

Closed
wants to merge 1 commit into from

Conversation

mapedraza
Copy link
Collaborator

@mapedraza mapedraza commented May 14, 2024

A part of original PR #1605 including test 533

0533 - Group with explicit attrs:[ ] (empty array) + active attributes + TimeInstant attribute + static

  • A - WHEN sending data and a measure called "t" (defined as TimeInstant attribte) through http IT should NOT
  • B - WHEN sending data and a measure called TimeInstant through http IT should NOT store anything into the

BUT some problems were discovered when using TimeInstant attribute and fucntionalities in cases 533 A) and B):

0533 A

Assertion Error - Context Broker received payload differs from expectation
+ expected - actual

-{
-  "TimeInstant": {
-    "type": "DateTime"
-    "value": "2015-12-14T08:06:01.468Z"
-  }
-  "id": "TestType:TestDevice"
-  "type": "TestType"
-}
+{}

0533 B

Assertion Error - Context Broker received payload differs from expectation
+ expected - actual

-{
-  "DateIssued": {
-    "metadata": {
-      "TimeInstant": {
-        "type": "DateTime"
-        "value": "2024-04-29T16:07:27.281Z"
-      }
-    }
-    "type": "DateTime"
-    "value": "2015-12-14T08:06:01.468Z"
-  }
-  "TimeInstant": {
-    "type": "DateTime"
-    "value": "2024-04-29T16:07:27.281Z"
-  }
-  "id": "TestType:TestDevice"
-  "type": "TestType"
-}
+{}

See #1605 (comment)

@fgalan
Copy link
Member

fgalan commented May 16, 2024

This is a future regression case for issue #1606

resource: '/iot/json',
apikey: globalEnv.apikey,
entity_type: globalEnv.entity_type,
explicitAttrs: "['DateIssued']",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mapedraza this explicitAttrs is not empty as suggest description case, is it?

TimeInstant: '2015-12-14T08:06:01.468Z'
}
},
expectation: {} // No payload expected
Copy link
Member

@AlvaroVega AlvaroVega May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mapedraza no CB update is represented in other testCases (like 0120) as null array:

expectation: []

@AlvaroVega
Copy link
Member

AlvaroVega commented May 17, 2024

IMHO with this group definition:

                        explicitAttrs: "[ ]",
                        timestamp: true,

a TimeInstant will be always propaged to CB, regardless attribute mapping definition.

This PR is as I think it would be: #1614

@AlvaroVega
Copy link
Member

AlvaroVega commented Jun 6, 2024

IMHO with this group definition:

                        explicitAttrs: "[ ]",
                        timestamp: true,

a TimeInstant will be always propaged to CB, regardless attribute mapping definition.

This PR is as I think it would be: #1614

If the logic is that explicitAttrs empty implies that no timestamp should be propagated to CB then the logic to change is

if (explicit instanceof Array && mustInsertTimeInstant) {

by adding check that explicit.length > 0

   if (explicit instanceof Array && explicit.length > 0 && mustInsertTimeInstant) {

@mapedraza
Copy link
Collaborator Author

overpassed by #1618

@mapedraza mapedraza closed this Jun 6, 2024
@fgalan fgalan deleted the task/add-533-func branch June 6, 2024 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants