@@ -104,21 +104,26 @@ public void testFolderConfiguration() throws IOException, SAXException {
104104 }
105105
106106 @ Test
107- @ Ignore // TODO this form is only accessible to Agent/ExtendedRead users from https://github.com/jenkinsci/jenkins/pull/4531
108- public void testAgentConfiguration () throws Exception {
109- Assume .assumeTrue (Jenkins .getVersion ().isNewerThanOrEqualTo (new VersionNumber ("2.234" ))); // TODO fix version
107+ public void testAgentConfigurationGlobally () throws Exception {
108+ Assume .assumeTrue (Jenkins .getVersion ().isNewerThanOrEqualTo (new VersionNumber ("2.238" )));
110109 final Slave agent = j .createSlave ();
111110 agent .setNodeProperties (Collections .singletonList (new AuthorizationMatrixNodeProperty ()));
112- assertPresentAndReadOnly ( "computer/" + agent .getNodeName () + "/configure" );
111+ assertPresentAndReadOnly ("computer/" + agent .getNodeName () + "/configure" );
113112
114- // Grant permission globally -- works with https://github.com/jenkinsci/jenkins/pull/4531 before https://github.com/jenkinsci/jenkins/pull/4531#pullrequestreview-408283044
115- ((ProjectMatrixAuthorizationStrategy )Jenkins .get ().getAuthorizationStrategy ()).add (Computer .CONFIGURE , "anonymous" );
113+ ((ProjectMatrixAuthorizationStrategy ) Jenkins .get ().getAuthorizationStrategy ()).add (Computer .CONFIGURE , Jenkins .ANONYMOUS .getName ());
114+ assertPresentAndEditable ("computer/" + agent .getNodeName () + "/configure" );
115+ }
116+
117+ @ Test
118+ public void testAgentConfigurationPerAgent () throws Exception {
119+ Assume .assumeTrue (Jenkins .getVersion ().isNewerThanOrEqualTo (new VersionNumber ("2.238" )));
120+ final Slave agent = j .createSlave ();
121+ agent .setNodeProperties (Collections .singletonList (new AuthorizationMatrixNodeProperty ()));
122+ assertPresentAndReadOnly ("computer/" + agent .getNodeName () + "/configure" );
116123
117- // Grant per-agent permission -- https://github.com/jenkinsci/jenkins/pull/4531#pullrequestreview-408283044 prevents this so far
118- // TODO use this once it works upstream
119- // final AuthorizationMatrixNodeProperty prop = new AuthorizationMatrixNodeProperty();
120- // prop.add(Computer.CONFIGURE, Jenkins.ANONYMOUS.getName());
121- // agent.setNodeProperties(Collections.singletonList(prop));
124+ final AuthorizationMatrixNodeProperty prop = new AuthorizationMatrixNodeProperty ();
125+ prop .add (Computer .CONFIGURE , Jenkins .ANONYMOUS .getName ());
126+ agent .setNodeProperties (Collections .singletonList (prop ));
122127 assertPresentAndEditable ( "computer/" + agent .getNodeName () + "/configure" );
123128 }
124129}
0 commit comments