Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 53 additions & 23 deletions .github/scripts/setup_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,28 @@
'password': 'testpass321',
'institution': 'Massachusetts Institute of Technology [Test]',
},
{
'username': 'testuser4@example.com',
'fullname': 'Test User 4',
'given_name': 'Test',
'family_name': 'User 4',
'given_name_ja': 'テスト',
'family_name_ja': 'ユーザー4',
'password': 'testpass654',
'institution': 'Massachusetts Institute of Technology [Test]',
'skip_project': True, # Dedicated user for project limit tests; no pre-created project
},
{
'username': 'testuser5@example.com',
'fullname': 'Test User 5',
'given_name': 'Test',
'family_name': 'User 5',
'given_name_ja': 'テスト',
'family_name_ja': 'ユーザー5',
'password': 'testpass987',
'institution': 'Massachusetts Institute of Technology [Test]',
'skip_project': True, # Dedicated user for project limit tests; no pre-created project
},
]

for user_data in test_users:
Expand Down Expand Up @@ -93,36 +115,44 @@
user.emails.create(address=username)
print(f"Created test user: {username}")

# Create a project for the new user
project = Node(
title=f"Test Project for {user_data['fullname']}",
creator=user,
category="project",
is_public=False
)
project.save()
print(f"Created test project: {project._id} for user: {username}")
# Output for CI config
print(f"PROJECT_ID_{username}: {project._id}")
print(f"PROJECT_NAME_{username}: {project.title}")
else:
print(f"Test user already exists: {username}")
# Ensure existing user has at least one project
user = OSFUser.objects.get(username=username)
if not user.nodes.filter(category='project').exists():
# Skip project creation for dedicated CI users (e.g. project limit test user)
if user_data.get('skip_project', False):
print(f"Skipping project creation for {username} (skip_project=True)")
else:
# Create a project for the new user
project = Node(
title=f"Test Project for {user.fullname}",
title=f"Test Project for {user_data['fullname']}",
creator=user,
category="project",
is_public=False
)
project.save()
print(f"Created test project: {project._id} for existing user: {username}")
print(f"Created test project: {project._id} for user: {username}")
# Output for CI config
print(f"PROJECT_ID_{username}: {project._id}")
print(f"PROJECT_NAME_{username}: {project.title}")
else:
print(f"Test user already exists: {username}")
# Skip project check for dedicated users that should not have projects
if user_data.get('skip_project', False):
print(f"Skipping project creation for {username} (skip_project=True)")
else:
project = user.nodes.filter(category='project').first()
# Output for CI config
print(f"PROJECT_ID_{username}: {project._id}")
print(f"PROJECT_NAME_{username}: {project.title}")
# Ensure existing user has at least one project
user = OSFUser.objects.get(username=username)
if not user.nodes.filter(category='project').exists():
project = Node(
title=f"Test Project for {user.fullname}",
creator=user,
category="project",
is_public=False
)
project.save()
print(f"Created test project: {project._id} for existing user: {username}")
else:
project = user.nodes.filter(category='project').first()
# Output for CI config
print(f"PROJECT_ID_{username}: {project._id}")
print(f"PROJECT_NAME_{username}: {project.title}")

# Affiliate users with institution
for user_data in test_users:
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,16 @@ jobs:
idp_username_other_institution: 'testuser3@example.com'
idp_password_other_institution: 'testpass321'
institution_name: 'Virginia Tech [Test]'


# Dedicated user for project limit number tests (no pre-created project)
idp_name_project_limit_1: 'FakeCAS'
idp_username_project_limit_1: 'testuser4@example.com'
idp_password_project_limit_1: 'testpass654'
institution_name_project_limit_1: 'Massachusetts Institute of Technology [Test]'
idp_name_project_limit_2: 'FakeCAS'
idp_username_project_limit_2: 'testuser5@example.com'
idp_password_project_limit_2: 'testpass987'

# Test project URLs (using created project IDs and names)
rdm_project_url_1: 'http://192.168.168.167:5000/${{ env.PROJECT_ID_1 }}/'
rdm_project_name_1: '${{ env.PROJECT_NAME_1 }}'
Expand Down
34 changes: 34 additions & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ def __init__(self, config_path, show_disk_usage=False, failed_result_path=None):
self.workflow_batch_project_count = 50
self.institution_name = None

# Project limit dedicated user parameters
self.idp_name_project_limit_1 = None
self.idp_username_project_limit_1 = None
self.idp_password_project_limit_1 = None
self.institution_name_project_limit_1 = None
self.idp_name_project_limit_2 = None
self.idp_username_project_limit_2 = None
self.idp_password_project_limit_2 = None

# Exclude notebooks
self.exclude_notebooks = []

Expand Down Expand Up @@ -413,6 +422,30 @@ def run_admin_tests(self):
)
)

def run_project_limit_tests(self):
"""Run project limit number tests."""
print('\n=== Project Limit Tests ===')

if not self.skip_admin:
self.result_notebooks.append(
self.run_notebook(
'取りまとめ-管理者機能-プロジェクト制限数.ipynb',
admin_rdm_url=self.admin_rdm_url,
idp_name_project_limit_1=getattr(self, 'idp_name_project_limit_1', None),
idp_username_project_limit_1=getattr(self, 'idp_username_project_limit_1', None),
idp_password_project_limit_1=getattr(self, 'idp_password_project_limit_1', None),
institution_name_project_limit_1=getattr(self, 'institution_name_project_limit_1', None),
idp_name_project_limit_2=getattr(self, 'idp_name_project_limit_2', None),
idp_username_project_limit_2=getattr(self, 'idp_username_project_limit_2', None),
idp_password_project_limit_2=getattr(self, 'idp_password_project_limit_2', None),
idp_name_integrated_admin=getattr(self, 'idp_name_integrated_admin', None),
idp_username_integrated_admin=getattr(self, 'idp_username_integrated_admin', None),
idp_password_integrated_admin=getattr(self, 'idp_password_integrated_admin', None),
skip_failed_test=self.skip_failed_test,
exclude_notebooks=self.exclude_notebooks,
)
)

def run_jupyterhub_tests(self):
"""Run BinderHub/TLJH related tests."""
print('\n=== JupyterHub Tests ===')
Expand Down Expand Up @@ -636,6 +669,7 @@ def run_all_tests(self):
self.run_s3compatsigv4_institutional_storage_tests()
self.run_metadata_tests()
self.run_admin_tests()
self.run_project_limit_tests()
self.run_jupyterhub_tests()
self.run_weko_tests()
self.run_workflow_tests()
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Loading