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

Development: Add test file for script to generate random results when creating large courses locally #9298

Conversation

az108
Copy link
Contributor

@az108 az108 commented Sep 7, 2024

Checklist

General

Motivation and Context

Recently, new Performance Guidelines were introduced. To help developers adhere to these guidelines, a script was created in this PR: #9252. The script allows for the creation of large courses locally or on test servers. These large courses can include a significant number of students and programming exercises with many student submissions. However, all of these student submissions currently result in a score of 0%. This PR addresses the issue by introducing a method for generating results that differ from 0%.

Description

A test file was added, which can either be included in the programming exercise test repository template (only if the script is used locally!). Additionally, an alternative approach was proposed for using the test file with an existing programming exercise on a test server or locally.

Steps for Testing (This PR can only be tested locally)

Prerequisites:

  • 1 Developer
  1. Checkout to this branch
  2. Navigate to "supporting_scripts/course-scripts"
  3. Follow the Steps listed in the README.me starting from : "### Optional: Generating Different Results For All Created Students (Should only be done Locally!!)"
    3.1 Run randomize_results_before.py
    3.2 Start the Artemis Server and Client
    3.3 Run large_course_main.py
    3.4 Run randomize_results_after.py
  4. Verify that after running the script the programming exercises created or used (based on the approach used in the ReadMe.me) has different student results other than 0 Percent.

Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance even for very large courses with more than 2000 students.
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance even for very large courses with more than 2000 students.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced documentation for setting up programming exercises with randomized test cases.
    • Introduced a comprehensive suite of unit tests utilizing randomized conditions to assess functionality.
    • Added scripts for managing test case files, including cleanup and setup processes for a streamlined workflow.
  • Bug Fixes

    • Improved clarity in instructions to prevent disruptions to original test case templates.
  • Documentation

    • Updated README with detailed steps for generating varied results for students and using existing programming exercises.
  • Chores

    • Modified build configuration to exclude specific directories from formatting tasks.

@az108 az108 requested a review from a team as a code owner September 7, 2024 15:50
@az108 az108 self-assigned this Sep 7, 2024
Copy link

coderabbitai bot commented Sep 7, 2024

Walkthrough

The changes introduce enhancements to the setup process for programming exercises, focusing on generating randomized test cases and utilizing existing exercises. New scripts are implemented to manage test case files by deleting outdated folders and copying new randomized test cases. A new Java test class is added to implement randomized unit tests, and the documentation is updated to provide clearer instructions for users regarding these processes.

Changes

Files Change Summary
README.md Enhanced documentation for setting up programming exercises, including instructions for generating randomized tests.
.../testFiles-template/randomized/RandomizedTestCases.java New test class implementing randomized unit tests to validate functionality under unpredictable conditions.
.../randomize_results_after.py New script for managing test case files, including deleting existing randomized test cases and copying default folders.
.../randomize_results_before.py New script for managing test files, including deleting outdated folders and copying a randomized test case file.
.../create_course.py Added error handling to invoke cleanup on course creation failure due to naming conflicts.
.../large_course_main.py Added cleanup function call to ensure state integrity after committing programming exercises.
.../manage_programming_exercise.py Added cleanup function call to handle existing exercises gracefully during creation conflicts.
build.gradle Modified spotless task configuration to exclude files in the supporting_scripts directory from formatting.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Script
    participant TestFiles

    User->>Script: Run randomize_results_before.py
    Script->>TestFiles: Delete existing folders (behavior, structural)
    Script->>TestFiles: Copy RandomizedTestCases.java
    User->>Script: Run randomize_results_after.py
    Script->>TestFiles: Delete RandomizedTestCases.java if exists
    Script->>TestFiles: Copy default template folders
Loading

Tip

New features

Walkthrough comment now includes:

  • Possibly related PRs: A list of potentially related PRs to help you recall past context.
  • Suggested labels: CodeRabbit can now suggest labels by learning from your past PRs. You can also provide custom labeling instructions in the UI or configuration file.

Notes:

  • Please share any feedback in the discussion post on our Discord.
  • Possibly related PRs, automatic label suggestions based on past PRs, learnings, and possibly related issues require data opt-in (enabled by default).

Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 0bd6be5 and 91680c2.

Files selected for processing (1)
  • supporting_scripts/course-scripts/quick-course-setup/README.md (1 hunks)
Additional context used
Markdownlint
supporting_scripts/course-scripts/quick-course-setup/README.md

190-190: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


173-173: Column: 3
Hard tabs

(MD010, no-hard-tabs)


179-179: Column: 3
Hard tabs

(MD010, no-hard-tabs)


189-189: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines

(MD022, blanks-around-headings)


178-178: Expected: 1; Actual: 2; Style: 1/2/3
Ordered list item prefix

(MD029, ol-prefix)


179-179: Expected: 2; Actual: 3; Style: 1/2/3
Ordered list item prefix

(MD029, ol-prefix)


183-183: Expected: 1; Actual: 4; Style: 1/1/1
Ordered list item prefix

(MD029, ol-prefix)


175-175: null
Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


177-177: null
Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


180-180: null
Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


182-182: null
Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


185-185: null
Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


174-174: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


178-178: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


179-179: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


183-183: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


184-184: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)

Additional comments not posted (2)
supporting_scripts/course-scripts/quick-course-setup/README.md (2)

169-187: Address markdown formatting issues and confirm content integration.

The new section provides essential instructions for generating varied results for students. However, several markdown formatting issues need to be addressed:

  • Replace hard tabs with spaces for consistency.
  • Ensure that fenced code blocks and lists are surrounded by blank lines to comply with markdown formatting rules.

These changes will enhance the readability and professionalism of the document.

Tools
Markdownlint

173-173: Column: 3
Hard tabs

(MD010, no-hard-tabs)


179-179: Column: 3
Hard tabs

(MD010, no-hard-tabs)


178-178: Expected: 1; Actual: 2; Style: 1/2/3
Ordered list item prefix

(MD029, ol-prefix)


179-179: Expected: 2; Actual: 3; Style: 1/2/3
Ordered list item prefix

(MD029, ol-prefix)


183-183: Expected: 1; Actual: 4; Style: 1/1/1
Ordered list item prefix

(MD029, ol-prefix)


175-175: null
Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


177-177: null
Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


180-180: null
Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


182-182: null
Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


185-185: null
Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


174-174: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


178-178: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


179-179: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


183-183: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


184-184: null
Lists should be surrounded by blank lines

(MD032, blanks-around-lists)


189-192: Improve markdown formatting around headings.

The section on using existing programming exercises is informative and integrates well with the document. However, ensure that headings are surrounded by blank lines to improve document structure and readability.

Tools
Markdownlint

190-190: Expected: 0 or 2; Actual: 1
Trailing spaces

(MD009, no-trailing-spaces)


189-189: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines

(MD022, blanks-around-headings)


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@az108 az108 added this to the 7.5.3 milestone Sep 7, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 7, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 8, 2024
Copy link
Contributor

@sarpsahinalp sarpsahinalp left a comment

Choose a reason for hiding this comment

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

A suggestion

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 8, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 8, 2024
raffifasaro
raffifasaro previously approved these changes Sep 8, 2024
Copy link

@raffifasaro raffifasaro left a comment

Choose a reason for hiding this comment

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

tested locally and worked as explained

sarpsahinalp
sarpsahinalp previously approved these changes Sep 8, 2024
Copy link
Contributor

@sarpsahinalp sarpsahinalp left a comment

Choose a reason for hiding this comment

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

LGTM thanks for adding my suggestion!

@az108 az108 dismissed stale reviews from raffifasaro and coderabbitai via 3ea94d6 September 9, 2024 14:54
coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 9, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Copy link

@raffifasaro raffifasaro left a comment

Choose a reason for hiding this comment

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

tested locally and still works as explained

Copy link
Contributor

@pzdr7 pzdr7 left a comment

Choose a reason for hiding this comment

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

Tested locally

Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

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

reapprove code

Copy link
Contributor

@sarpsahinalp sarpsahinalp left a comment

Choose a reason for hiding this comment

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

Reapprove

Copy link
Contributor

@Jan-Thurner Jan-Thurner left a comment

Choose a reason for hiding this comment

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

Code LGTM

@krusche krusche merged commit 253c2ca into develop Sep 14, 2024
25 of 29 checks passed
@krusche krusche deleted the feature/general/add-randomized-scores-for-created-exercises-in-large-course-setup-script branch September 14, 2024 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

7 participants