Commit Graph

191 Commits

Author SHA1 Message Date
Tucker McKnight 0991a6e8b8 spec: Don't add non-200 status requests to openapi spec
This is a temporary fix to avoid having invalid query
parameters documented in the request schemas.

Also, this change makes the yaml file names match the
controller name instead of using the first part of
the url, since so many of our endpoints start with
/accounts.

test plan:
- Run `OPENAPI=1 rspec spec/controllers/lti/registrations_controller_spec.rb`
- See that a file was created in spec/openapi/lti/registrations.yaml
  - It would have been in spec/openapi/accounts.yaml without this change
- See that the word "bad" does not show up in the yaml file (several tests
  use "bad" as an example of an invalid query parameter)

Change-Id: Ib7c0093bc8b36fc42bdbb13edb910c61449359f5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/352231
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Tucker Mcknight <tmcknight@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
2024-07-23 01:37:07 +00:00
Cody Cutrer c50cab6c98 drop Rails 7.0 support
closes AE-882

Change-Id: I6d1205e826f3bf83528c957592fbf677a03ab508
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/350884
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2024-07-05 15:30:54 +00:00
Cody Cutrer 69e5ebc777 bundle update rubocop
and apply new cop 99% Style/SuperArguments

and a couple Layout/EmptyComment and Style/ArgumentsForwarding that
are found by fixes in those cops

Change-Id: Icc0af9c8065f035bca43868b564f73e8776052f2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/348626
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jake Oeding <jake.oeding@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
2024-05-30 16:20:52 +00:00
Cody Cutrer 87c4ba22d1 migrations: avoid creating extraneous data in the test env
it's all going to get truncated anyway

Change-Id: I77a0134f397413774eb659d6d90d4e3796823e0f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/342852
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2024-03-13 19:37:02 +00:00
Cody Cutrer 8173aaef08 spec: pass example as a block in around hooks
Change-Id: I0a262ae7e3c034dd14edbe9801d8b27ddfa00aff
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/341927
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2024-03-01 21:45:31 +00:00
Cody Cutrer 75673a24d4 rails 7.1: spec/lib
closes AE-778

[skip-stages=Flakey]

Change-Id: Ie7143a47c5bd38ca55391a530f7e1b3673ffb4fc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/340746
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2024-02-21 17:51:31 +00:00
Cody Cutrer f0414f4714 rails 7.1: fix checking for skipped migrations in specs
Change-Id: If1d3e18695248db30b6735ac64193dd02669eb2c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/339556
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2024-02-02 19:12:53 +00:00
Cody Cutrer 3135c83e1f just run migrations in test when necessary
instead of complaining that they need to be run

also fix the migration check to look at actual versions, not just count of
migrations, in case a migration has been renamed or deleted - throwing
off counts

Change-Id: Ifefdf5783cc908db4053ed79fa54f767dcb61514
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/339251
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2024-01-30 18:27:03 +00:00
Cody Cutrer 8eeebf32b3 bundle update rubocop
lots of autocorrect of RSpec/RedundantPredicateMatcher, and some
manual corrections of RSpec/RemoveConst (mostly ignoring it)

[skip-stages=Flakey]
[skip-crystalball]

Change-Id: I57a01c06a5f2dafd985912c5ea9dc18e199eddaa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/337931
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
2024-01-24 16:17:43 +00:00
Tucker McKnight f53bf990ce spec: generate openapi docs from specs
test plan:
- run some controller tests with the environment variable
  OPENAPI=1
- see that some files have been put in the spec/openapi
  directory
- e.g.: delete spec/openapi/lti/registration_token.yaml, then run
  OPENAPI=1 bundle exec rspec \
  spec/controllers/lti/ims/dynamic_registration_controller_spec.rb

refs INTEROP-8389

Change-Id: I3008a4079013e547bf264808aa7b2f092db8b6a6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/323583
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Paul Gray <paul.gray@instructure.com>
QA-Review: Paul Gray <paul.gray@instructure.com>
Product-Review: Paul Gray <paul.gray@instructure.com>
Build-Review: Aaron Ogata <aogata@instructure.com>
2024-01-19 00:06:18 +00:00
Cody Cutrer c32d30f662 bundle update rubocop
[skip-stages=Flakey]
[skip-crystalball]

and apply corrections from new/updated cops:

 * Layout
 * Lint/AmbiguousRange
 * Lint/RedundantSafeNavigation
 * Style/HashEachMethods
 * Style/HashSyntax
 * Style/InverseMethods
 * Style/RedundantLineContinuation
 * Style/RedundantParentheses
 * Style/RedundantReturn
 * Style/SuperWithArgsParentheses
 * Style/SymbolProc

Change-Id: I787e46f5b1c89e0fedebd5452ba74567d66954c1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/334291
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Build-Review: Aaron Ogata <aogata@instructure.com>
Migration-Review: Aaron Ogata <aogata@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-12-06 14:25:02 +00:00
James Butters afa0cbe365 skip crystalball on package.json or yarn.lock changes
flag = none

Change-Id: I5e96f86f77b9e8e33bdba56c055e2e158b1824e7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/330930
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
2023-10-23 15:27:26 +00:00
James Butters 4b5a6ac539 crystalball run full rspec suite with gem updates
When updating gems we want to ensure a full
suite of specs is run.
flag = none

Change-Id: Ic2d12e2cc7f464021120837cac1ed78609417109
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/325788
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
2023-08-22 14:46:49 +00:00
James Butters c0ef47ebb7 prepend cystalball diff with gems/plugins
plugin builds are not getting accurate predictions,
override some of crystalball's methods to fit the way
Canvas-LMS handles plugins.

fixes: DE-1596
flag = none
[force-crystalball]

Change-Id: Ib347737f9e7f65660830ce0ffaaa6b3bc0a27f86
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/324830
QA-Review: James Butters <jbutters@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
2023-08-15 16:26:39 +00:00
Cody Cutrer aa7041d2c1 update rubocop, and apply new cops
[skip-stages=Flakey]

Change-Id: I2d3ffbeb652a6668941125a8a2afe87f104c8d0a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/321953
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-07-03 22:11:42 +00:00
Cody Cutrer 5431d47758 rubocop: Rails/I18nLocaleAssignment
manually done. the big one was the explicit locale assignment
in set_locale_with_localizer needs undone in a controller callback

then using with_locale everywhere, specs no longer need to be concerned
about being in an uncertain locale

Change-Id: I5a1d2c907a6f52ee4d8c2307b8c789a1f1ea436e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/320112
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-06-13 21:59:50 +00:00
Jacob Burroughs 7dcc507d0a Rubocop for ruby 3.1
[skip-stages=Flakey]

Change-Id: I6abefdfa9fed6dd4525c8786e93efa548b3710f2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/319603
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
2023-06-06 16:44:26 +00:00
Cody Cutrer 502aa068da rubocop: Layout/Multiline*LineBreaks
[skip-stages=Flakey]

Change-Id: I24912809267088bc19a4082c49bc5f78ca7b76bb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/317302
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-05-01 19:31:42 +00:00
Cody Cutrer 0fed7b7336 switch to native pg12 collation for ICU sorting
closes AE-81

test plan:
 * the people page for an account or course should load properly,
   and still sort properly (enforced by specs)

Change-Id: Id8f252af44b2fa4a31786c5c4b7fef9d2aad0946
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/314759
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-04-12 17:18:46 +00:00
Cody Cutrer b2b0bff902 rubocop: Style/TernaryParentheses, Style/RedundantParentheses
[skip-stages=Flakey]

Change-Id: I8d860eedd8b199ed3adf0e2bf9162b43096c5347
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/315130
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
2023-04-12 14:56:48 +00:00
Cody Cutrer c101827780 rubocop: Style/RedundantConstantBase
[skip-stages=Flakey]

Change-Id: Ie18389de5b45f433aa82a13f62daa2a5a9d44b80
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/315120
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-04-10 20:56:27 +00:00
Aaron Ogata e219d6de77 allow forcing crystal ball to run despite config changes
refs DE-1220

Change-Id: I12d3e9b4728e94c816a6bf610345aedf18c1baa7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/303477
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
Build-Review: James Butters <jbutters@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-10-18 16:32:35 +00:00
Ahmad Amireh 55713bb8e8 (webpack) upgrade to webpack 5
refs FOO-2835
flag = none

there are no behavioral changes, only what was necessary to do the
upgrade, see inline comments for explanation where it was warranted

Change-Id: I737f31a210365f190ddb606e96e8eb84e2359e0d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/294133
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-06-23 15:14:37 +00:00
Jacob Burroughs 5dcd66d8c6 Some rails 7 tests passing
Change-Id: Iad400936d7e53a5f92644f260c95bfb5bf9e972f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/293144
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
Migration-Review: Alex Slaughter <aslaughter@instructure.com>
2022-06-06 14:23:03 +00:00
Aaron Ogata 485dc1df16 don’t perform redundant DB operations in Jenkins test runs
refs DE-1207

Change-Id: I93d69baf2235dd0cdf243f3188813661b19d3c41
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/292928
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
2022-06-01 17:42:18 +00:00
Jacob Burroughs c7bf5fba48 Remove rails 6.0 support
Change-Id: I0df8f625c119b2622e358a5d663c158e2d7d7cb8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/292904
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-05-31 22:13:22 +00:00
Brian Watson a87301eaf7 Add file check to crystalball smoke test and move to rspecq
flag=none

[skip-stages=Flakey Spec Catcher]

Test-plan:
- verify that minimal files are displayed for missing in the map
- ensure that Test Plan junit displays ~45,000 specs run

Change-Id: I516103e3d3348b4f7deaf4124044e8276dfc707e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/288539
Reviewed-by: James Butters <jbutters@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Brian Watson <bwatson@instructure.com>
2022-04-07 15:09:29 +00:00
Aaron Ogata 9098145ff5 use Rails.version check instead of CANVAS_RAILS variable
refs DE-523

Change-Id: I7baff2f4a6dee7beb518c6d1151a3027a7572f57
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287809
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-03-23 20:33:24 +00:00
Evan Battaglia 86768548d8 In NRPS, include "TestUser" role for test students
Needed to fix all_roles to properly dedup (it was joining some with ","
before doing the 'uniq').

closes INTEROP-7282
flag=none

Test plan:
- Go to a course and make a student
- use StudentView in the upper-right
- Hit NRPS for the course, e.g.,
  http web.canvas-lms2.docker/api/lti/courses/61/names_and_roles \
    Authorization:\ Bearer\ myltiadvantagetoken
- The test student should have "Learner" and "TestUser" roles
- The regular student should just just have the "Learner" role
- Launch an LTI 1.3 tool in this course as the test student and look at
  the roles claim. It should have (same as before this commit):
    "http://purl.imsglobal.org/vocab/lis/v2/institution/person#Student",
    "http://purl.imsglobal.org/vocab/lis/v2/system/person#User",
    "http://purl.imsglobal.org/vocab/lti/system/person#TestUser"
  "Learner" and "TestUser" role (and possibly others), with no
- Launch an LTI 1.3 tool in an account context. It should have these
  roles (same as before this commit):
    "http://purl.imsglobal.org/vocab/lis/v2/institution/person#Student",
    "http://purl.imsglobal.org/vocab/lis/v2/membership#Learner",
    "http://purl.imsglobal.org/vocab/lis/v2/system/person#User",
    "http://purl.imsglobal.org/vocab/lti/system/person#TestUser"

Change-Id: I968674b8445b8833de3e57d900b67286d7fd8a23
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287501
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-03-21 21:30:19 +00:00
James Butters fa4ac3875d filter tests on parent
if all tests files in a dir are included in the crystalball
prediction, just run the parent dir to reduce arguments sent
to rspecq.

flag = none
fixes: DE-1073

Change-Id: I816d2f00e221b74652ed485e414866372def7dcb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/285949
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
2022-03-14 17:35:40 +00:00
Brian Watson d777e7b08d Remove gem specs not in spec_canvas from crystalball prediction
flag=none

Test-plan:
- PS1's run including gems/canvas_cache/spec/canvas_cache/redis_spec.rb
  shouldn't send that spec to rspecq

Change-Id: I8e5a08c6bdf829a4c338262533c395e013adb378
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286606
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Brian Watson <bwatson@instructure.com>
2022-03-09 19:09:31 +00:00
Brian Watson 95f24c083a Skip crystalball if build changes present
flag=none

Test-plan:
- verify Jenkinsfile triggers complete re-run

Change-Id: I44d1b3766caab2fb8c693122cd8b770e74f8ebb9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/285558
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Brian Watson <bwatson@instructure.com>
2022-02-23 18:22:29 +00:00
Brian Watson fbf6004254 Bypass crystalball if changes match config/feature_flags.*yml
flag=none

Test-plan:
- test with changed config ruby file
- test with changed config feature flag yaml file

Change-Id: Ia0bb8bc113ada1e2f7b590c5db223869308401f0
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/285429
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Brian Watson <bwatson@instructure.com>
2022-02-17 19:35:50 +00:00
Jacob Burroughs 209cea8027 Rails 6.1 basic spec functionality
Change-Id: I89129633731a68c38a5026b6b26318d1f3699a2a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284968
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-02-16 17:31:11 +00:00
James Butters 6ea42d864b missed changing one reference of new_files to file_changes
Change-Id: Id27ffbb08609e61a207dcab78ae480a2301a01b9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/285238
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
Reviewed-by: Spencer Olson <solson@instructure.com>
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
Reviewed-by: Ryan Norton <rnorton@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
Tested-by: James Butters <jbutters@instructure.com>
2022-02-15 19:01:54 +00:00
Brian Watson 737d2dc808 Bypass crystalball if changes match config/.*\.rb
flag=none

Test-plan:
- test with changed config ruby file
- verify yml example files in config/ don't trigger
  complete re-run

Change-Id: Ia11c0c522cf3ab064fe16e140fed2df4414a022c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/285098
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Brian Watson <bwatson@instructure.com>
2022-02-15 17:24:25 +00:00
Brian Watson aa2e095ee8 Handle long crystalball spec key name entries in yaml dump
flag=none

Test-plan:
- build map in jenkins
- push map to s3 manually
- reference map in test PS

Change-Id: I78c0c57f970256f84120fe3c336e882d6f3d41e2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284590
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
2022-02-08 16:42:21 +00:00
Brian Watson b9cbe6e772 Enable all rspec tests to generate crystalball map coverage
flag=none

Test-plan:
- unit tests have entries in the crystalball map

Change-Id: I9a05fd5c050f0b4142dfc19fb3b960fdb00f3584
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283875
Reviewed-by: James Butters <jbutters@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Brian Watson <bwatson@instructure.com>
2022-02-01 17:23:26 +00:00
Brian Watson 0412324fc7 Sort crystalball ruby + js items
flag=none
Test-plan:
- new map should have ruby coverage items sorted first
  and then js items sorted and added after

Change-Id: I8053fb7be7a77ff82ab7e12b73ebd4eb2f4c551f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283786
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Brian Watson <bwatson@instructure.com>
2022-01-28 18:25:41 +00:00
Brian Watson 79b1ede72d Start Coverage gathering earlier to prevent coverage holes
flag=none

Test-plan:
- generate new map, make sure more things are present without
  losing things

Change-Id: I135673942b1fd6353e2a22d2c0441449bab531b2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/280525
Reviewed-by: James Butters <jbutters@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Brian Watson <bwatson@instructure.com>
2022-01-27 00:20:26 +00:00
Ahmad Amireh e61659ffdf refactor RevManifest to simplify the CDN interface
refs FOO-2520
flag = none

[pin-commit-multiple_root_accounts=2a9bf89895f38df6bf8f54828af66aced594abf0]

revisit the API for resolving asset names to their (real)path on disk,
because adding to the existing logic to support an alternative bundler
made things hard to understand.

This patch brings a new simplified interface Canvas::Cdn::Registry to
query assets and resolve their location.

- Registry#include?(path) tells whether a realpath points to a static
  asset
- Registry#statics_available? tells whether static assets are available
- Registry#scripts_available? tells whether JS assets are available
- Registry#scripts_for(bundle) provides the realpaths to all the JS
  files in the specified bundle
- Registry#url_for(name) provides the realpath to the static asset

The Registry is a good place to house the BrandableCSS resolving logic
in the future for even more consistency. It can also support an
alternative bundler internally without leaking. Eventually, it would be
nice to have it as a gem.

CHANGES
-------

- helper "font_url_for()" has been removed as it was a duplicate of
  existing logic; instead use "font_path(...)" to achieve the correct
  result. As a result, BrandableCSS is no longer querying Gulp's
  manifest.
- preloaded fonts are now aware of the asset host and work for CDN
- InfoController uses the new Registry API to tell whether Gulp and
  Webpack have produced their assets successfully
- ApplicationHelper no longer re-computes the base URL for JavaScripts,
  now only the Registry is concerned with that
- ?optimized_js query parameter is no longer supported as it has no real
  benefit now that we have access to sourcemaps on production
- ENV['USE_OPTIMIZED_JS'] is now more consistent as there is a single
  source of truth for it. The Registry can be instantiated with
  {environment: "production"} to point to the optimized version of the
  scripts.
- "css:compile" task no longer writes BrandConfig records to the DB,
  that is now done as part of the "compile_assets" task, which you can
  opt out of doing by setting COMPILE_ASSETS_BRAND_CONFIGS=0

TEST PLAN
---- ----

- load your dashboard and verify all the assets are loaded correctly
- set up a CDN, restart your Rails server and reload the dashboard
  - verify all assets are loaded from the CDN
  - verify the Lato fonts are pre-loaded from the CDN
- (optional) add custom JS to a sub-account and visit it
  - verify the custom JS is loaded and evaluated *after* Canvas's main
    javascript bundles

Change-Id: I8198de747cdd5892d6a831cb6c61ba0ef9afa789
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276537
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2022-01-06 20:20:40 +00:00
Brian Watson f87e9e352d Add new file crystalball predictor to enqueue complete re-run
closes OUT-4922

Test-plan:
- Get a copy of crystalball_map.yml, copy it to canvas root
- Available via #crystalball-noisy
- Look at a file that has changes under a given spec
- make changes to it, and add it to a new commit
- verify via crystalball dry-run that specs are predicted and
  printed out to crystalball_spec_list.txt
- create a new .rb file
- run crystalball dry-run again and verify that the output
  warns about a "new file detected" and that the dry-run
  produces only a "." in the crystalball_spec_list.txt file

Change-Id: Ia2a5754c02814d681f1d375f5bc7357774b08926
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/281613
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Manoel Quirino <manoel.quirino@instructure.com>
Reviewed-by: Michael Hargiss <mhargiss@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Brian Watson <bwatson@instructure.com>
2021-12-21 18:12:29 +00:00
Bobby Buten cbe6d16d94 spec: abort rspec if pending migrations are found
refs DE-920
flag=none

It's easy to forget to run migrations on your test db. This commit
checks before rspec spins up and will bail early with a helpful
reminder.

TEST PLAN
  1) make sure your db migrations are up to date
    > RAILS_ENV=test bundle exec rails migrate
  2) run a sample rspec test
    > bundle exec rspec -fd spec/support/test_database_utils.rb
    - it should run normally without failures
  3) rollback the most recent migration
    > RAILS_ENV=test bundle exec rails db:rollback STEP=1
  4) run the same sample test
    > bundle exec rspec -fd spec/support/test_database_utils.rb
    - it should fail with PendingMigrationError
  5) run the same sample test with SKIP_MIGRATION_CHECK=1
    > SKIP_MIGRATION_CHECK=1 bundle exec rspec -fd spec/support/test_database_utils.rb
    - it should run normally without failurs
  6) rerun steps 1 & 2

Change-Id: I4dfd11ae40f48295c3f1967e4b4b847adb1277af
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/280910
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Bobby Buten <bobby.buten@instructure.com>
Product-Review: Bobby Buten <bobby.buten@instructure.com>
2021-12-15 13:10:06 +00:00
James Butters fca3312001 remove remaining rspecq conditionals
flag = none

Test Plan:
-Jenkins passes
-Crystalball map generation build passes

Change-Id: If2190816b0ec31066837430b826369891ceac783
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/280297
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Brian Watson <bwatson@instructure.com>
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
2021-12-08 16:33:38 +00:00
Brian Watson 96fbbf87c9 Revert "Revert "Crystalball post-merge map generation""
Also moves config/initializer/crystalball.rb to spec/support
to prevent it from running in prod

This reverts commit 9a9c68be6e.

Test-plan:
- passes cd to edge without failure
- generates map successfully in PoC build

Change-Id: I67c02ebaea06e11b3a3721aa49217da16e75bd32
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279848
Reviewed-by: Michael Hargiss <mhargiss@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Brian Watson <bwatson@instructure.com>
2021-12-01 17:35:52 +00:00
Cody Cutrer c2cba46851 RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation
[skip-stages=Flakey]

auto-corrected

Change-Id: I4a0145abfd50f126669b20f3deaeae8377bac24d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279535
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:03:06 +00:00
Cody Cutrer e73cf9ddf4 RuboCop: Style/HashSyntax
[skip-stages=Flakey]

auto-corrected

Change-Id: I9371a61046aee6b148f89dd434114a8ba2b1188c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279533
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:02:35 +00:00
Cody Cutrer 9b71ed2054 RuboCop: Style/BlockDelimiters, Style/Lambda
[skip-stages=Flakey]

auto-corrected

Change-Id: I642f868d75c079e698f1fe4161bbbe419dbe1827
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279374
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 21:30:47 +00:00
Cody Cutrer c302dd8bc1 RuboCop: Style/SymbolArray, Style/WordArray
[skip-stages=Flakey]

auto-corrected

Change-Id: Id187ed60c5590025e780d81b85b5212f51368f27
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279196
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 14:30:08 +00:00
Cody Cutrer 04e28fd25c RuboCop: Style/Next
[skip-stages=Flakey]

auto-corrected

Change-Id: Ia842e948dc2f6f0eb2d39a66e1c56cc4fe90bd5c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279168
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 14:29:04 +00:00