Skip to content

Conversation

jpinsonneau
Copy link
Contributor

@jpinsonneau jpinsonneau commented Jan 16, 2025

Description

Add array type and format to field configs.

Dependencies

netobserv/network-observability-operator#999

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
    • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
    • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
    • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
    • Standard QE validation, with pre-merge tests unless stated otherwise.
    • Regression tests only (e.g. refactoring with no user-facing change).
    • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Copy link

openshift-ci bot commented Jan 16, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.22%. Comparing base (bb407dd) to head (490b1ad).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #681      +/-   ##
==========================================
+ Coverage   56.83%   59.22%   +2.39%     
==========================================
  Files         197      159      -38     
  Lines       10154     6919    -3235     
  Branches     1192     1192              
==========================================
- Hits         5771     4098    -1673     
+ Misses       4015     2620    -1395     
+ Partials      368      201     -167     
Flag Coverage Δ
uitests 59.22% <ø> (ø)
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

see 37 files with indirect coverage changes

@jpinsonneau jpinsonneau force-pushed the 2056 branch 2 times, most recently from 8761eee to 3d66d39 Compare January 16, 2025 15:53
@jpinsonneau jpinsonneau marked this pull request as ready for review January 16, 2025 15:53
@jpinsonneau
Copy link
Contributor Author

/retest

- 2: Inner (with the same source and destination node)
- name: IfDirections
type: number
type: number array
Copy link
Member

Choose a reason for hiding this comment

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

in another PR ( https://github.com/netobserv/network-observability-operator/pull/999/files#diff-1fc45b6b65862012ab2d4a19e8f92ce31c1801f0ed7c464c13ac3f0dc5a3b756R1268 - which you can review btw ;-) ), I'm doing the same kind of thing, except I use a new field name to avoid breaking something in the console. So, I guess it means I can rollback that part.
Just, I used the brackets convention to describe an array, like number[] ; wdyt, I'd say it's sufficiently known convention so we can use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can change the array keyword to [] indeed 👌

Copy link
Member

@jotak jotak Jan 20, 2025

Choose a reason for hiding this comment

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

an advantage of [] is that it takes less space here https://docs.openshift.com/container-platform/4.17/observability/network_observability/json-flows-format-reference.html
On my screen, the table isn't displayed full-width (also because of the TOC column) - IMO it could be better to keep it small

Copy link
Member

Choose a reason for hiding this comment

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

although in the API reference
image
it's "array (string)", so yet something else. Honestly, I don't care too much :-) It's just that string[] felt more natural to me, of course I have my developer bias

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -1,8 +1,11 @@
export type FieldType = 'string' | 'number';
export type FieldType = 'string' | 'string array' | 'number' | 'number array';
Copy link
Member

Choose a reason for hiding this comment

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

isn't it going to break something in the forceType function? This was the concern I had in netobserv/network-observability-operator#999 and the reason why I introduced docType instead ...

Copy link
Member

Choose a reason for hiding this comment

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

(actually, reading the code again, maybe it was because I used object[] for net events that I had to introduce docType)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

forceType is skipping arrays so it should be good for now:

const forceType = (id: ColumnsId, value: ColValue, type?: FieldType): ColValue => {
if (!type) {
console.error('Column ' + id + " doesn't specify type");
}
// check if value type match and convert it if needed
if (value && value !== '' && typeof value !== type && !Array.isArray(value)) {

We may improve it if needed. We could force arrays too 🤔

Copy link
Member

@jotak jotak left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot removed the lgtm label Jan 23, 2025
@jpinsonneau
Copy link
Contributor Author

Flags are currently number instead of array of numbers in the mocks data which made cypress fail.
I have improved the forceType function accordingly to manage such cases: 804f09e

I will update the mocks in a followup since I need a cluster with fresh data

@jotak
Copy link
Member

jotak commented Jan 23, 2025

/lgtm

Copy link

openshift-ci bot commented Jan 23, 2025

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

openshift-ci bot commented Jan 23, 2025

@jpinsonneau: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/qe-e2e-console-tests 93b52dd link false /test qe-e2e-console-tests
ci/prow/plugin-cypress 804f09e link true /test plugin-cypress

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@jpinsonneau
Copy link
Contributor Author

Merging this as the field test is now passing.
There is an issue with the number of columns I will address in another PR:

1) netflow-table
       manage columns:
      AssertionError: Timed out retrying after 10000ms: Too many elements found. Found '57', expected '56'.
      + expected - actual
      -57
      +56
      
      at Context.eval (webpack://netobserv-plugin/./cypress/support/commands.ts:107:65)

@jpinsonneau jpinsonneau merged commit 11b964f into netobserv:main Jan 23, 2025
6 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants