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

fix(graphql): remove non-null constraints for active recs action #1417

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

tthvo
Copy link
Member

@tthvo tthvo commented Mar 15, 2023

Welcome to Cryostat! 👋

Before contributing, make sure you have:

  • Read the contributing guidelines
  • Linked a relevant issue which this PR resolves
  • Linked any other relevant issues, PR's, or documentation, if any
  • Resolved all conflicts, if any
  • Rebased your branch PR on top of the latest upstream main branch
  • Attached at least one of the following labels to the PR: [chore, ci, docs, feat, fix, test]
  • Signed the last commit: git commit --amend --signoff

Related to cryostatio/cryostat-web#906

Description of the change:

Remove non-null constraints for active recording actions. This allows data to be returned when an error occurs.

Motivation for the change:

See cryostatio/cryostat-web#906 (comment)

How to manually test:

Try on JDP group with some targets that cannot start/stop/delete recordings. Check the response for the data field.

Start Recording

query StartRecordingForGroup() {
  environmentNodes(filter: { name: "JDP" }) {
    name
    descendantTargets {
      name
      doStartRecording(recording: {
        name: "foo",
        template: "Continuous",
        templateType: "TARGET",
        duration: 0,
        restart: true,
        metadata: {
          labels: [
            {
              key: "cryostat.io.topology-group",
              value: "JDP"
            }
          ]
        },
        }) {
            name
            state
      }
    }
  }
}

Stop Recording

query StopRecordingForGroup (){
    environmentNodes(filter: { name: "JDP" }) {
      name
      descendantTargets {
        name
        recordings {
            active(filter: { name: "foo" }) {
                data {
                    doStop {
                      name
                      state
                    }
                }
            }
        }
      }
    }
}

Delete Recording

query DeleteRecordingForGroup (){
    environmentNodes(filter: { name: "JDP" }) {
      name
      descendantTargets {
        name
        recordings {
            active(filter: { name: "foo" }) {
                data {
                    doDelete {
                      name
                      state
                    }
                }
            }
        }
      }
    }
}

@tthvo tthvo added the fix label Mar 15, 2023
@mergify mergify bot added the safe-to-test label Mar 15, 2023
@tthvo tthvo marked this pull request as ready for review March 15, 2023 23:34
@github-actions
Copy link
Contributor

Test image available:

$ CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat:pr-1417-80be643ade922f013bb1d4c8c08f977f4d61b180 sh smoketest.sh

@tthvo
Copy link
Member Author

tthvo commented Mar 16, 2023

Error response:

{
   "errors":[
      {
         "message":"Exception while fetching data (/environmentNodes[0]/descendantTargets[0]/doStartRecording) : org.openjdk.jmc.rjmx.ConnectionException caused by java.lang.SecurityException: Authentication failed! Invalid username or password",
         "locations":[
            {
               "line":1,
               "column":161
            }
         ],
         "path":[
            "environmentNodes",
            0,
            "descendantTargets",
            0,
            "doStartRecording"
         ],
         "extensions":{
            "classification":"DataFetchingException"
         }
      },
      {
         "message":"Exception while fetching data (/environmentNodes[0]/descendantTargets[2]/doStartRecording) : org.openjdk.jmc.rjmx.ConnectionException caused by java.lang.SecurityException: Authentication failed! Invalid username or password",
         "locations":[
            {
               "line":1,
               "column":161
            }
         ],
         "path":[
            "environmentNodes",
            0,
            "descendantTargets",
            2,
            "doStartRecording"
         ],
         "extensions":{
            "classification":"DataFetchingException"
         }
      },
      {
         "message":"Exception while fetching data (/environmentNodes[0]/descendantTargets[3]/doStartRecording) : org.openjdk.jmc.rjmx.ConnectionException caused by java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: non-JRMP server at remote endpoint]",
         "locations":[
            {
               "line":1,
               "column":161
            }
         ],
         "path":[
            "environmentNodes",
            0,
            "descendantTargets",
            3,
            "doStartRecording"
         ],
         "extensions":{
            "classification":"DataFetchingException"
         }
      }
   ],
   "data":{
      "environmentNodes":[
         {
            "name":"JDP",
            "descendantTargets":[
               {
                  "name":"service:jmx:rmi:///jndi/rmi://cryostat:9091/jmxrmi",
                  "doStartRecording":null
               },
               {
                  "name":"service:jmx:rmi:///jndi/rmi://cryostat:9093/jmxrmi",
                  "doStartRecording":{
                     "name":"cryostat_topology_action",
                     "state":"RUNNING"
                  }
               },
               {
                  "name":"service:jmx:rmi:///jndi/rmi://cryostat:9094/jmxrmi",
                  "doStartRecording":null
               },
               {
                  "name":"service:jmx:rmi:///jndi/rmi://cryostat:9095/jmxrmi",
                  "doStartRecording":null
               }
            ]
         }
      ]
   }
}

@tthvo tthvo force-pushed the graphql-schema branch 2 times, most recently from 61451ee to 4d7ccf5 Compare March 16, 2023 18:44
@github-actions
Copy link
Contributor

Test image available:

$ CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat:pr-1417-4d7ccf53c57f9eb99d571a152353315fc8a11160 sh smoketest.sh

andrewazores
andrewazores previously approved these changes Mar 16, 2023
@github-actions
Copy link
Contributor

Test image available:

$ CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat:pr-1417-581123295b978c299cdf4c2517b1b2fee907c815 sh smoketest.sh

@andrewazores
Copy link
Member

@tthvo rebase + (re)sign commit please

@github-actions
Copy link
Contributor

Test image available:

$ CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat:pr-1417-96978e8242ebe38ef317e341e807bbc4f093e334 sh smoketest.sh

@tthvo
Copy link
Member Author

tthvo commented Mar 16, 2023

Yep rebased and signed^^

Signed-off-by: Thuan Vo <thvo@redhat.com>
@github-actions
Copy link
Contributor

Test image available:

$ CRYOSTAT_IMAGE=ghcr.io/cryostatio/cryostat:pr-1417-3a0f7a2c0ba5c8c9d03d3368d55dd582f17acda1 sh smoketest.sh

@andrewazores andrewazores merged commit 8a901ab into cryostatio:main Mar 16, 2023
@tthvo tthvo deleted the graphql-schema branch March 16, 2023 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants