T
TBD10mo ago
ALR

Kotlin Test Support

Starting a thread for coordinating Kotlin testsuite and code snippit work 🤘🏻
85 Replies
ALR
ALR10mo ago
@dayhaysoos-tbd Here's the issue I'm starting on for this today: https://github.com/TBD54566975/developer.tbd.website/issues/1175 I've also set public pairing sessions in #adhoc-huddle Wed-Fri so we can stay synced. I'll dig into setting up the runtime today! I got both web5-kt and tbdex-kt building as a first step. The READMEs need to be updated to give contributors better guidance. And I have some questions for the Core ENG team here in #tbdex about the versions we're using. @dayhaysoos-tbd Do we yet have a shared upstream branch to work on in the dev site?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
@dayhaysoos-tbd You got it. Do we have an umbrella issue for this work I can name the branch after?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
@dayhaysoos-tbd Boom: https://github.com/TBD54566975/developer.tbd.website/issues/1176 Go ahead and add any smaller dependencies in there to the summary! I've found just a couple already. And created branch for us here @dayhaysoos-tbd: https://github.com/TBD54566975/developer.tbd.website/tree/issue-1176/add-kotlin-test-support Let's share that one and put all work relating to Kotlin support in there.
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
@dayhaysoos-tbd - Final answer on Gradle for the build for dev site? Couple reasons I ask: 1) If we're going to Maven in the medium-term anyway, why duplicate work? 2) As a downstream consumer we can really align on whatever build system we like 3) Honestly I'm just much quicker with Maven
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
OK, you're really comfortable with my standing up the dev site Kotlin stuff w/ Maven?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
OK awesome thank you. 🫡 Where test suite will live: don't know just yet, should have stuff to share tomorrow in our peer jam session. Right now I've got status in here with some open questions. Namely the Java runtime versions we're aligning on. I'll likely go into the upstream projects with PRs to make build prereqs clear and see if I can get to version alignment on tbdex-kt (on Java 17) and web5-kt (on Java 11). I do have them both building locally now so that's a win. Gotta update READMEs in PRs to make that process easier.
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
@dayhaysoos-tbd Maybe I should invert the question 🙂 Where do you need the Kotlin testuite to be?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
OK will try for that. Maven for instance has test convention of src/test/main under the folder where the pom.xml is, sure I can change that Saw your new issues @dayhaysoos-tbd - awesome! Should they be moved from open-source-programs repo to the developer.tbd.website repo, and on the OSP Project Board? I have Kotlin runtime added to the Dev Site in the issue-1176/add-kotlin-test-support branch. There's a minimal test showing web5-kt can be imported and a call made to web5-did module using Java 17. There's a draft PR to see ongoing changes and commits. To use: 1) Bring in this branch locally 2) Follow the new instructions to set up the Java runtime in the README 3) Run pnpm test:kotlin 4) See output:
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running website.tbd.developer.site.Web5DidTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.465 s - in website.tbd.developer.site.Web5DidTest
[INFO] Running website.tbd.developer.site.CalculatorTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in website.tbd.developer.site.CalculatorTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jar:3.0.2:jar (default-jar) @ kotlin-testsuite ---
[INFO] Building jar: /Users/alr/git/TBD54566975/developer.tbd.website/site/testsuite-kotlin/target/kotlin-testsuite-0.1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running website.tbd.developer.site.Web5DidTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.465 s - in website.tbd.developer.site.Web5DidTest
[INFO] Running website.tbd.developer.site.CalculatorTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in website.tbd.developer.site.CalculatorTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jar:3.0.2:jar (default-jar) @ kotlin-testsuite ---
[INFO] Building jar: /Users/alr/git/TBD54566975/developer.tbd.website/site/testsuite-kotlin/target/kotlin-testsuite-0.1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
Next: @dayhaysoos-tbd and I have an open pairing session today. Let's see if this test infra is living in the right place in the repo, and how we can hook it into the Shnip system so that the Kotlin code and tests there can be annotated for inclusion into the site's docs. cc: @techgirl1908 ^ @codermickey - Do we know why FOSSA is failing license checks in the web5-kt suite? The license info is in Maven Central.
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Say more @dayhaysoos-tbd ? It is in the pnpm scripts of that branch? Ah sorry pnpm test:kotlin
ALR
ALR10mo ago
GitHub
developer.tbd.website/package.json at issue-1176/add-kotlin-test-su...
Source for the TBD Developer Website. Contribute to TBD54566975/developer.tbd.website development by creating an account on GitHub.
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Rad, huh? I’m amped to get it annotated with Shnip
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
I have some in there @dayhaysoos-tbd
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
They’re not real examples we would publish but they’re Kotlin and they run and everything Oh no not from real examples
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Nice Yes let’s port em in
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
@blackgirlbytes Are they Web5 or tbDEX? I’m waiting on a tbDEX release to Maven Central to bring in those dependencies; Web5 is ready to go on 0.10.0 Hell yeah, BTW
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
We can port - thanks for the pointer! @dayhaysoos-tbd Lemme know if you need help with dep management or anything in setup
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Probably not. I made the whole folder structure outside of the dev site first and then lift and shifted it in. You’ll just need to update the package.json test:Kotlin script to point to the new location. And today let’s talk about the structure of that tests dir because I saw last night it was not originally partitioned by language Like you’ll have to move the whole testsuite-kotlin folder, not just individual files.
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Yeah Kotlin needs the whole folder structure as I have it - Maven build info, file conventions etc apply. It’s not just freefloating scripts like we have in JS land
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Yup
ALR
ALR10mo ago
@dayhaysoos-tbd Any idea why the hardcoded MDX version above does source code highlighting differently from the CodeSnippet version below?
No description
ALR
ALR10mo ago
OT @blackgirlbytes but wanted to raise to you while I'm in here - Kotlin guide does not note the packages or import statements needed to use classes like VerifiableCredential? Is this expected, reflected elsewhere, or an issue to raise? https://developer.tbd.website/docs/web5/build/verifiable-credentials/jwt-to-vc @dayhaysoos-tbd site/snippets is not in .gitignore; as these files are generated by the build, shouldn't they be? @techgirl1908 Update. ✅ Kotlin TestSuite is in place ✅ Shnip system can consume Kotlin code and surface it as docs. We did this with one of @blackgirlbytes guides to prove it out There are some housekeeping things I want to do with the PR before we merge it in, and there will be things to review with @devRel regarding some changes locations for the testsuites. By end of week you will be unblocked on Kotlin testsuite writing, likely by COB Thursday. And this work @dayhaysoos-tbd and I did today paves the way to nicely slide Swift testsuite support in right next to the other suites. Will set a meeting with @devRel for top of next week to show and tell how to use Kotlin on the site and get it surfaced in your docs. @dayhaysoos-tbd I rebased and force-pushed to our branch. There's a new error there now due to changes that came in via main. Can you identify where the new broken reference is? https://github.com/TBD54566975/developer.tbd.website/actions/runs/7733947122/job/21087707729?pr=1183 Tomorrow: let's hook up the kotlin suite to pnpm test and adjust the CI workflow if necessary in Actions. The sooner we get this merged, the less we have to worry about rebasing and getting new errors due to forward development in main. @blackgirlbytes Here is how we transformed your code blocks as real Kotlin. And here is how we test it.
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Ha oh boy, which also raises that we're documenting in Gradle @blackgirlbytes while our own suites are in Maven (and I'm converting the upstream *-kt suites to use Maven). Worth to developers to show how to do imports for both, or at least show them the GAV instead of Gradle- or Maven-specific ways to declare the dependency? I recommend the build tool non-specific way and just show the GAV to get the dependency, let devs implement the dep declaration in their tool of choice.
ALR
ALR10mo ago
Like this is Gradle-specific:
No description
ALR
ALR10mo ago
vs. just saying "Declare in your build tool a dependency upon xyz.block:web5-credentials:0.0.9-delta (which is a version we need to externalize, too!) WOW getting this all aligned is a lot of effort but totally worth it when it comes together!
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
HAPPY to help, for real I'm having so much fun in ALR's JVM Week
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Set time with me to pair if you wanna review any of your Kotlin guides and we can get 'em clean and aliged w/ conventions
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Get me Twitch famous
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Nope, no change in system. I laid out the main code as main code, put snippets around it, and wrote tests for those. If you want to lay it out where everything is in tests and you put snippets on those, it supports that too. Dev preference; I write main code as main and test it by convention. Adapt to your taste. 🤘🏻
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
@devRel - @dayhaysoos-tbd and I are prepping a PR that changes the location of your __tests__ folder. This PR will unblock you from writing Kotlin tests and snippets. Could you please hold on any commits to main that change existing code snippets? It'll help me avoid merge conflicts. I expect to have this PR cleared in the next couple of hours and you'll be back to business as usual.
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Yeah existing PRs would need to be rebased once this is in to bring in the new location. I'll work with you to make it as painless as possible. @devRel As I'm sorting through this rebase, I want to make sure I'm not dropping any of your changes. It's true that you removed the DidIon methods in docs and tests, correct?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
📰 ⏰ @devRel Kotlin Testsuite Support and Code Snippets for it are now live. 🚀 Props props @dayhaysoos-tbd for the integration with Snippets and @blackgirlbytes for the early feedback and pairing. You are again clear to push to main. ✅ You'll need to rebase your branches/PRs to take in the changes cleanly, and there may be some merge conflicts due to folder renaming. There are 2 important takeaways for you now, both noted in the commit message * Java Development Kit is now an installation prerequisite when running pnpm test * The location of site/__tests__ is now site/testsuites/testsuite-javascript/__tests__ I've set a Kotlin Bootcamp on the OSS Public Calendar for Monday to intro the team to JVM development - we can talk through IDE setup, environments, Maven configs, etc. And we have a session after that to show you where Kotlin tests should live and how to run them. We'll gather feedback from the team on usability changes and anything you'd like to incrementally improve. Was eager to get this in quickly to: 1) Unblock you from writing tested Kotlin code and including it into docs in Snippets 2) Clear the way for further merge conflicts due to the rename. Any other questions before Monday - hit us up here!
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
🤘🏻
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Sure, I combined the main and test code together into a canonical example. * Test * Doc calling the Snippet
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Should have Swift support done by lunch tomorrow
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Teamwork makes the dream work. Say it with me - developer.tbd.website is the singular home of all our community efforts. The one place to get at our software and learn how to use it. And everything in there works as advertised. If we step back, we can see how amazing it is that a project of our maturity is doing tested docs in several languages. It’s an industry leading experience for a project at any phase - and we are living it. And the software itself is there to help people - welcoming more folks into a biased economic system. Proud to be on the team making this all real. I was kidding when I said it but whelp this is done.
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
This is what I was working on when my suites broke locally - https://github.com/TBD54566975/developer.tbd.website/issues/1196
GitHub
Refactor testsuite folder names for brevity · Issue #1196 · TBD5456...
We have testsuites in: site/testsuites/testsuite-* The JS TestSuite is most egregious: site/testsuites/testsuite-javascript/tests* Slim this to: site/testsuites/$langname @angiejones raised in ...
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
@blackgirlbytes Wanna jump into #tbdiscussions? Looks fine on main here:
$> rm -rf site/snippets
$> pnpm shnip

> @ shnip /Users/alr/git/TBD54566975/developer.tbd.website
> node ./shnippet/src/cli

$> ls -l site/snippets
total 0
drwxr-xr-x 3 alr staff 96 Feb 2 14:41 testsuite-javascript
drwxr-xr-x 3 alr staff 96 Feb 2 14:41 testsuite-kotlin
$> rm -rf site/snippets
$> pnpm shnip

> @ shnip /Users/alr/git/TBD54566975/developer.tbd.website
> node ./shnippet/src/cli

$> ls -l site/snippets
total 0
drwxr-xr-x 3 alr staff 96 Feb 2 14:41 testsuite-javascript
drwxr-xr-x 3 alr staff 96 Feb 2 14:41 testsuite-kotlin
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
For @dayhaysoos-tbd: We should probably enhance the Shnip config to do something like .gitignore; it's making snippet outputs for the target directory where the build copies sources, so @blackgirlbytes accidentally was hunting in the wrong folder, one that shouldn't exist. All part of discovering features for Shnip through using it in different ways! 😄
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
@AceKYD From the error:
Module not found: Error: Can"t resolve "@site/snippets/testsuite-kotlin/src/test/kotlin/docs/web5/build/decentralizedidentifiers/importDidsKt.snippet.kt" in "/opt/build/repo/site/docs/web5/build/decentralized-identifiers"
Module not found: Error: Can"t resolve "@site/snippets/testsuite-kotlin/src/test/kotlin/docs/web5/build/decentralizedidentifiers/importDidsKt.snippet.kt" in "/opt/build/repo/site/docs/web5/build/decentralized-identifiers"
Got your paths/filenames wrong somewhere?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Running your branch locally
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Getting:
Module not found: Error: Can't resolve '@site/snippets/testsuite-kotlin/src/test/kotlin/docs/web5/build/decentralizedidentifiers/importDidsKt.snippet.kt' in '/Users/alr/git/TBD54566975/developer.tbd.website/site/docs/web5/build/decentralized-identifiers'
Module not found: Error: Can't resolve '@site/snippets/testsuite-kotlin/src/test/kotlin/docs/web5/build/decentralizedidentifiers/importDidsKt.snippet.kt' in '/Users/alr/git/TBD54566975/developer.tbd.website/site/docs/web5/build/decentralized-identifiers'
And in my console:
$> ls -l /Users/alr/git/TBD54566975/developer.tbd.website/site/docs/web5/build/decentralized-identifiers
total 32
-rw-r--r-- 1 alr staff 42 Feb 2 10:24 _category_.json
-rw-r--r-- 1 alr staff 6710 Feb 2 16:25 how-to-create-did.mdx
-rw-r--r-- 1 alr staff 2561 Feb 2 10:24 key-management.mdx
$> ls -l /Users/alr/git/TBD54566975/developer.tbd.website/site/docs/web5/build/decentralized-identifiers
total 32
-rw-r--r-- 1 alr staff 42 Feb 2 10:24 _category_.json
-rw-r--r-- 1 alr staff 6710 Feb 2 16:25 how-to-create-did.mdx
-rw-r--r-- 1 alr staff 2561 Feb 2 10:24 key-management.mdx
So where is importDidsKt.snippet.kt in the folder developer.tbd.website/site/docs/web5/build/decentralized-identifiers? Isn't that what it's expecting? @AceKYD ^
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR10mo ago
Yeah @dayhaysoos-tbd is also gonna be updating Shnip to clear the snippets dir before regenerating so that doesn’t happen again. He’s on it next week!
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR9mo ago
Hey @dayhaysoos-tbd this is really awesome - getting everything into one system. Props to you man, having an awesome week. 🔥
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR9mo ago
You got it man. If you're working on something that's completed or not broken, you're not programming. 🤣
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
ALR
ALR9mo ago
Thank you @dayhaysoos-tbd! Doing the tough “make it all work in one place” stuff 🤘🏻
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server