1
+ using System . Net . Http . Headers ;
2
+ using System . Text ;
3
+ using NUnit . Framework ;
4
+
5
+ namespace AiServer . Tests ;
6
+
7
+ public class ConnectivityTests
8
+ {
9
+ [ Test , Explicit ( "Integration test" ) ]
10
+ public async Task Can_call_supermicro ( )
11
+ {
12
+ // Environment.SetEnvironmentVariable("DOTNET_SYSTEM_NET_DISABLEIPV6", "1");
13
+ // var url = "http://192.168.4.200:11434/api/tags";
14
+ var url = "https://supermicro.pvq.app/api/tags" ;
15
+ using var client = new HttpClient ( ) ;
16
+ var res = await client . GetAsync ( url ) ;
17
+ res . EnsureSuccessStatusCode ( ) ;
18
+ var json = await res . Content . ReadAsStringAsync ( ) ;
19
+ Console . WriteLine ( json ) ;
20
+ }
21
+
22
+ [ Test , Explicit ( "Integration test" ) ]
23
+ public async Task Can_call_GetOllamaModels ( )
24
+ {
25
+ // Environment.SetEnvironmentVariable("DOTNET_SYSTEM_NET_DISABLEIPV6", "1");
26
+ // var url = "https://openai.servicestack.net/api/GetOllamaModels"
27
+ // .AddQueryParam("ApiBaseUrl", "https://supermicro.pvq.app");
28
+ var url = "https://okai.servicestack.com/models/gist?prompt=1735872878252" ;
29
+ using var client = new HttpClient ( ) ;
30
+ var res = await client . GetAsync ( url ) ;
31
+ res . EnsureSuccessStatusCode ( ) ;
32
+ var json = await res . Content . ReadAsStringAsync ( ) ;
33
+ Console . WriteLine ( json ) ;
34
+ }
35
+
36
+ [ Test , Explicit ( "Integration test" ) ]
37
+ public async Task Can_call_groq ( )
38
+ {
39
+ var url = "https://api.groq.com/openai/v1/chat/completions" ;
40
+ using var client = new HttpClient ( ) ;
41
+ var content = new StringContent (
42
+ """
43
+ {
44
+ "messages": [{
45
+ "role": "user",
46
+ "content": "Capital of France?"
47
+ }],
48
+ "model": "qwen-qwq-32b",
49
+ "max_tokens": 2048,
50
+ "temperature": 0.7,
51
+ "stream": false
52
+ }
53
+ """ ,
54
+ Encoding . UTF8 , "application/json" ) ;
55
+ client . DefaultRequestHeaders . Authorization = new AuthenticationHeaderValue ( "Bearer" , Environment . GetEnvironmentVariable ( "GROQ_API_KEY" ) ) ;
56
+ client . DefaultRequestHeaders . Accept . Add ( new MediaTypeWithQualityHeaderValue ( "application/json" ) ) ;
57
+
58
+ var res = await client . PostAsync ( url , content ) ;
59
+ res . EnsureSuccessStatusCode ( ) ;
60
+ var json = await res . Content . ReadAsStringAsync ( ) ;
61
+ Console . WriteLine ( json ) ;
62
+ }
63
+ }
0 commit comments