Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BBesrour committed Oct 15, 2024
1 parent 8ec3f57 commit 7c98073
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import de.tum.cit.aet.artemis.assessment.domain.AssessmentType;
import de.tum.cit.aet.artemis.assessment.domain.Result;
import de.tum.cit.aet.artemis.assessment.domain.Visibility;
import de.tum.cit.aet.artemis.buildagent.dto.DockerRunConfig;
import de.tum.cit.aet.artemis.core.domain.Course;
import de.tum.cit.aet.artemis.core.exception.BadRequestAlertException;
import de.tum.cit.aet.artemis.exercise.domain.Exercise;
Expand Down Expand Up @@ -822,7 +823,11 @@ public void validateSettingsForFeedbackRequest() {
*/
public void validateBuildPlanNetworkAccessForProgrammingLanguage() {
if (List.of(ProgrammingLanguage.SWIFT, ProgrammingLanguage.HASKELL).contains(getProgrammingLanguage())) {
throw new BadRequestAlertException("This programming language does not support disabling the network access feature", "Exercise", "networkAccessNotSupported");
ProgrammingExerciseBuildConfig buildConfig = getBuildConfig();
DockerRunConfig dockerRunConfig = buildConfig.getDockerRunConfig();
if (dockerRunConfig != null && dockerRunConfig.isNetworkDisabled()) {
throw new BadRequestAlertException("This programming language does not support disabling the network access feature", "Exercise", "networkAccessNotSupported");
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public void setSolutionCheckoutPath(String solutionCheckoutPath) {
*
* @return a {@link DockerRunConfig} object initialized with the parsed flags, or {@code null} if an error occurs
*/
public DockerRunConfig getDockerRunConfigFromString() {
public DockerRunConfig getDockerRunConfig() {
if (StringUtils.isBlank(dockerFlags)) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ private BuildConfig getBuildConfig(ProgrammingExerciseParticipation participatio
dockerImage = programmingLanguageConfiguration.getImage(programmingExercise.getProgrammingLanguage(), Optional.ofNullable(programmingExercise.getProjectType()));
}

DockerRunConfig dockerRunConfig = buildConfig.getDockerRunConfigFromString();
DockerRunConfig dockerRunConfig = buildConfig.getDockerRunConfig();

List<String> resultPaths = getTestResultPaths(windfile);
resultPaths = buildScriptProviderService.replaceResultPathsPlaceholders(resultPaths, buildConfig);
Expand Down

0 comments on commit 7c98073

Please sign in to comment.