@@ -970,31 +970,33 @@ void createMiiOl8slim(TestInfo testInfo) throws Exception {
970
970
// verify the docker image is created
971
971
assertTrue (imageExists (tagName ), "Image was not created: " + tagName );
972
972
973
- validateDirectoryPermissions ("/u01/domains" , "drwxrwxr-x" , tagName , out );
974
- validateDirectoryPermissions ("/u01/wdt" , "drwxrwxr-x" , tagName , out );
975
- validateDirectoryPermissions ("/u01/wdt/models" , "drwxrwxr-x" , tagName , out );
976
- validateDirectoryPermissions ("/u01/wdt/weblogic-deploy" , "drwxr-x---" , tagName , out );
977
- validateDirectoryPermissions ("/u01/oracle" , "drwxr-xr-x" , tagName , out );
973
+ validateFilePermissions ("/u01/domains" , "drwxrwxr-x" , tagName , out );
974
+ validateFilePermissions ("/u01/wdt" , "drwxrwxr-x" , tagName , out );
975
+ validateFilePermissions ("/u01/wdt/models" , "drwxrwxr-x" , tagName , out );
976
+ validateFilePermissions ("/u01/wdt/weblogic-deploy" , "drwxr-x---" , tagName , out );
977
+ validateFilePermissions ("/u01/oracle" , "drwxr-xr-x" , tagName , out );
978
+ validateFilePermissions ("/u01/wdt/weblogic-deploy/bin/createDomain.sh" , "-rwxr-x---" , tagName , out );
979
+ validateFilePermissions ("/u01/wdt/weblogic-deploy/bin/validateModel.sh" , "-rwxr-x---" , tagName , out );
978
980
}
979
981
}
980
982
981
983
/**
982
984
* Verify file permissions for a specified path on the given image.
983
- * @param directory Directory name to check for permissions value.
985
+ * @param path Filename or Directory to check for permissions value.
984
986
* @param expected Expected permission string, such as "drwxrwxr-x"
985
987
* @param tagName Tag name or image ID of the image to inspect
986
988
* @param out The printwriter where the docker run command will send stdout/stderr
987
989
* @throws IOException if process start fails
988
990
* @throws InterruptedException if the wait is interrupted before the process completes
989
991
*/
990
- private void validateDirectoryPermissions (String directory , String expected , String tagName , PrintWriter out )
992
+ private void validateFilePermissions (String path , String expected , String tagName , PrintWriter out )
991
993
throws IOException , InterruptedException {
992
- String command = String .format (" docker run -t %s ls -ld %s" , tagName , directory );
994
+ String command = String .format (" docker run --rm - t %s ls -ld %s" , tagName , path );
993
995
String actual = Runner .run (command , out , logger ).stdout ().trim ();
994
996
String [] tokens = actual .split (" " , 2 );
995
- assertEquals (2 , tokens .length , "Unable to get directory permissions for " + directory );
997
+ assertEquals (2 , tokens .length , "Unable to get file permissions for " + path );
996
998
// When running on an SELinux host, the permissions shown by ls will end with a "."
997
- assertTrue (tokens [0 ].startsWith (expected ), "Incorrect directory permissions for " + directory );
999
+ assertTrue (tokens [0 ].startsWith (expected ), "Incorrect file permissions for " + path );
998
1000
}
999
1001
1000
1002
/**
@@ -1026,6 +1028,8 @@ void updateAddModel(TestInfo testInfo) throws Exception {
1026
1028
1027
1029
// verify the docker image is created
1028
1030
assertTrue (imageExists (tagName ), "Image was not created: " + tagName );
1031
+ validateFilePermissions ("/u01/wdt/weblogic-deploy/bin/createDomain.sh" , "-rwxr-x---" , tagName , out );
1032
+ validateFilePermissions ("/u01/wdt/weblogic-deploy/bin/validateModel.sh" , "-rwxr-x---" , tagName , out );
1029
1033
}
1030
1034
}
1031
1035
0 commit comments