-
Notifications
You must be signed in to change notification settings - Fork 326
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
Change layout of local library search path in order to be able to move Round_Spec.enso
back to Tests
#7634
Change layout of local library search path in order to be able to move Round_Spec.enso
back to Tests
#7634
Changes from all commits
7bdda0f
420b311
f4f1d9c
e0ff029
e3c51a9
cf2cbd0
83728ee
7771d4a
dc64dbf
c297c83
25ddd88
e810382
b5bf679
24ba65e
385dd4d
f2407da
f472f7b
5488afd
dffd99c
eb3933c
ab524be
93695fc
becb9ec
a44aadb
5868b2e
40af6a1
05bf37d
fe427bf
a56b744
06be852
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,74 @@ | ||||
package org.enso.languageserver.libraries | ||||
|
||||
import akka.actor.ActorSystem | ||||
import akka.testkit._ | ||||
import org.enso.distribution.FileSystem.PathSyntax | ||||
import org.enso.editions.LibraryName | ||||
import org.enso.librarymanager.LibraryLocations | ||||
import org.enso.pkg.PackageManager | ||||
import org.enso.testkit.WithTemporaryDirectory | ||||
import org.scalatest.matchers.should.Matchers | ||||
import org.scalatest.wordspec.AnyWordSpecLike | ||||
import org.scalatest.BeforeAndAfterAll | ||||
import org.scalatest.time.SpanSugar.convertIntToGrainOfTime | ||||
|
||||
import scala.concurrent.duration.FiniteDuration | ||||
|
||||
class LocalLibraryManagerSpec | ||||
extends TestKit(ActorSystem("TestSystem")) | ||||
with ImplicitSender | ||||
with AnyWordSpecLike | ||||
with Matchers | ||||
with BeforeAndAfterAll | ||||
with WithTemporaryDirectory { | ||||
|
||||
val Timeout: FiniteDuration = 10.seconds | ||||
|
||||
override def afterAll(): Unit = { | ||||
TestKit.shutdownActorSystem(system) | ||||
} | ||||
|
||||
"LocalLibraryManager" should { | ||||
"find the libraries it has itself created" in { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is partially redundant with Line 55 in 5dc2c4c
So IMO it may make sense to keep both - the role of the newly added one is to ensure the logic for creating a library is kept in-sync with the logic for resolving them. The other test is just an integration test checking library management. |
||||
val projectRoot = getTestDirectory / "project-root" | ||||
PackageManager.Default.create(projectRoot.toFile, "Test_Project_123") | ||||
val localLibraryRoot = getTestDirectory / "local-library-root" | ||||
val libraryLocations = LibraryLocations( | ||||
List(localLibraryRoot), | ||||
getTestDirectory / "library-cache-root", | ||||
List() | ||||
) | ||||
val manager = | ||||
system.actorOf( | ||||
LocalLibraryManager.props(projectRoot.toFile, libraryLocations) | ||||
) | ||||
|
||||
val myLibraryName = LibraryName("user456", "My_Library") | ||||
|
||||
manager ! LocalLibraryManagerProtocol.Create( | ||||
myLibraryName, | ||||
Seq(), | ||||
Seq(), | ||||
"CC0" | ||||
) | ||||
expectMsg(Timeout, LocalLibraryManagerProtocol.EmptyResponse()) | ||||
|
||||
manager ! LocalLibraryManagerProtocol.FindLibrary(myLibraryName) | ||||
expectMsgPF(Timeout, "FindLibraryResponse") { | ||||
case LocalLibraryManagerProtocol.FindLibraryResponse(Some(root)) => | ||||
assert(root.location.startsWith(localLibraryRoot)) | ||||
} | ||||
|
||||
manager ! LocalLibraryManagerProtocol.ListLocalLibraries | ||||
val foundLibraries = expectMsgPF(Timeout, "ListLocalLibrariesResponse") { | ||||
case LocalLibraryManagerProtocol.ListLocalLibrariesResponse( | ||||
libraries | ||||
) => | ||||
libraries | ||||
} | ||||
foundLibraries.map(entry => | ||||
LibraryName(entry.namespace, entry.name) | ||||
) should contain theSameElementsAs Seq(myLibraryName) | ||||
} | ||||
} | ||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue #1877 was closed some time ago as part of a cleanup, but it indeed remains unsolved - there are a few TODOs referencing it and indeed the error handling in that part is not fully developed but a shortcut.
It may be worth to re-open the issue. However, this part of the API is not yet being used by the IDE. I guess we may wait until it starts being used to re-visit these improvements. But let's keep in mind there is some missing functionality there that should be filled-in once this is actually used.