skkuding / codedang

Online Judge for SKKU
https://codedang.com
MIT License
43 stars 9 forks source link

[Bug]: Backend Test가 CI에서 통과되면 안되는데, 통과가 되는 버그가 존재합니다. #1756

Closed gyunseo closed 2 months ago

gyunseo commented 4 months ago

Describe the bug

How to Reproduce

git checkout main

cd apps/backend
pnpm test
  270 passing (960ms)
  5 failing

  1) ProblemService
       deleteProblem
         should return deleted problem:
     TypeError: Cannot read properties of undefined (reading 'deleteMany')
      at ProblemService.deleteProblem (apps/admin/src/problem/problem.service.ts:517:31)
      at async Context.<anonymous> (apps/admin/src/problem/problem.service.spec.ts:265:22)

  2) GroupService
       getGroups
         should return a list of groups that showOnList is true:

      AssertionError: expected { …(2) } to deeply equal { …(2) }
      + expected - actual

             "id": 4
             "memberNum": 2
           }
         ]
      -  "total": 2
      +  "total": 4
       }

      at Context.<anonymous> (apps/client/src/group/group.service.spec.ts:136:27)

  3) SubmissionService
       getContestSubmisssions
         should return submissions:
     TypeError: Cannot read properties of undefined (reading 'findFirst')
      at SubmissionService.getContestSubmissions (apps/client/src/submission/submission.service.ts:646:44)
      at /workspace/node_modules/.pnpm/nestjs-otel@5.1.5_@nestjs+common@10.3.9_class-transformer@0.5.1_class-validator@0.14.1_reflec_ijr7iadn7n5dxx67o5xooiutgy/node_modules/nestjs-otel/lib/tracing/decorators/span.js:19:26
      at NoopContextManager.with (/workspace/node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/src/context/NoopContextManager.ts:31:15)
      at ContextAPI.with (/workspace/node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/src/api/context.ts:77:42)
      at NoopTracer.startActiveSpan (/workspace/node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/src/trace/NoopTracer.ts:98:27)
      at ProxyTracer.startActiveSpan (/workspace/node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/src/trace/ProxyTracer.ts:51:20)
      at SubmissionService.PropertyDescriptor (/workspace/node_modules/.pnpm/nestjs-otel@5.1.5_@nestjs+common@10.3.9_class-transformer@0.5.1_class-validator@0.14.1_reflec_ijr7iadn7n5dxx67o5xooiutgy/node_modules/nestjs-otel/lib/tracing/decorators/span.js:16:27)
      at Context.<anonymous> (apps/client/src/submission/submission.service.spec.ts:423:23)
      at processImmediate (node:internal/timers:478:21)

  4) SubmissionService
       getContestSubmisssions
         should throw exception if user is not registered to contest:

      AssertionError: expected promise to be rejected with 'NotFoundException' but it was rejected with 'TypeError: Cannot read properties of …'
      + expected - actual

      -TypeError: Cannot read properties of undefined (reading 'findFirst')
      +NotFoundException

  5) SubmissionService
       getContestSubmisssions
         should throw exception if contest doesn't have this problem:

      AssertionError: expected promise to be rejected with 'NotFoundException' but it was rejected with 'TypeError: Cannot read properties of …'
      + expected - actual

      -TypeError: Cannot read properties of undefined (reading 'findFirst')
      +NotFoundException

 ELIFECYCLE  Test failed. See above for more details.

와 같이 현재 local에서 mocha test를 돌리면, 에러가 나오는데, GitHub CI에서 잡히지 않습니다. 빨리 해결해야 될 문제로 보입니다.

Reproduction

1. 2. 3.

Logs

270 passing (960ms) 5 failing

1) ProblemService deleteProblem should return deleted problem: TypeError: Cannot read properties of undefined (reading 'deleteMany') at ProblemService.deleteProblem (apps/admin/src/problem/problem.service.ts:517:31) at async Context. (apps/admin/src/problem/problem.service.spec.ts:265:22)

2) GroupService getGroups should return a list of groups that showOnList is true:

  AssertionError: expected { …(2) } to deeply equal { …(2) }
  + expected - actual

         "id": 4
         "memberNum": 2
       }
     ]
  -  "total": 2
  +  "total": 4
   }

  at Context.<anonymous> (apps/client/src/group/group.service.spec.ts:136:27)

3) SubmissionService getContestSubmisssions should return submissions: TypeError: Cannot read properties of undefined (reading 'findFirst') at SubmissionService.getContestSubmissions (apps/client/src/submission/submission.service.ts:646:44) at /workspace/nodemodules/.pnpm/nestjs-otel@5.1.5@nestjs+common@10.3.9_class-transformer@0.5.1_class-validator@0.14.1_reflec_ijr7iadn7n5dxx67o5xooiutgy/node_modules/nestjs-otel/lib/tracing/decorators/span.js:19:26 at NoopContextManager.with (/workspace/node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/src/context/NoopContextManager.ts:31:15) at ContextAPI.with (/workspace/node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/src/api/context.ts:77:42) at NoopTracer.startActiveSpan (/workspace/node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/src/trace/NoopTracer.ts:98:27) at ProxyTracer.startActiveSpan (/workspace/node_modules/.pnpm/@opentelemetry+api@1.8.0/node_modules/@opentelemetry/api/src/trace/ProxyTracer.ts:51:20) at SubmissionService.PropertyDescriptor (/workspace/nodemodules/.pnpm/nestjs-otel@5.1.5@nestjs+common@10.3.9_class-transformer@0.5.1_class-validator@0.14.1_reflec_ijr7iadn7n5dxx67o5xooiutgy/node_modules/nestjs-otel/lib/tracing/decorators/span.js:16:27) at Context. (apps/client/src/submission/submission.service.spec.ts:423:23) at processImmediate (node:internal/timers:478:21)

4) SubmissionService getContestSubmisssions should throw exception if user is not registered to contest:

  AssertionError: expected promise to be rejected with 'NotFoundException' but it was rejected with 'TypeError: Cannot read properties of …'
  + expected - actual

  -TypeError: Cannot read properties of undefined (reading 'findFirst')
  +NotFoundException

5) SubmissionService getContestSubmisssions should throw exception if contest doesn't have this problem:

  AssertionError: expected promise to be rejected with 'NotFoundException' but it was rejected with 'TypeError: Cannot read properties of …'
  + expected - actual

  -TypeError: Cannot read properties of undefined (reading 'findFirst')
  +NotFoundException

 ELIFECYCLE  Test failed. See above for more details.

System Info

No response

Validations

jimin9038 commented 3 months ago

Changed the connected Notion task status to not-started

TAS-603 [Bug]: Backend Test가 CI에서 통과되면 안되는데, 통과가 되는 버그가 존재합니다.